aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/HOWTO4
-rw-r--r--Documentation/development-process/5.Posting8
-rw-r--r--Documentation/driver-model/devres.txt1
-rw-r--r--Documentation/filesystems/debugfs.txt32
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/arm/include/asm/mach/time.h2
-rw-r--r--arch/arm/kernel/leds.c21
-rw-r--r--arch/arm/mach-bcmring/core.c1
-rw-r--r--arch/arm/mach-exynos/cpu.c15
-rw-r--r--arch/arm/mach-exynos/irq-eint.c2
-rw-r--r--arch/arm/mach-exynos/pm.c10
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c2
-rw-r--r--arch/arm/mach-ks8695/irq.c2
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c2
-rw-r--r--arch/arm/mach-msm/board-sapphire.c2
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-realview/realview_eb.c2
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c2
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c2
-rw-r--r--arch/arm/mach-realview/realview_pba8.c2
-rw-r--r--arch/arm/mach-realview/realview_pbx.c2
-rw-r--r--arch/arm/mach-s3c2410/bast-irq.c2
-rw-r--r--arch/arm/mach-s3c2410/cpu-freq.c26
-rw-r--r--arch/arm/mach-s3c2410/dma.c28
-rw-r--r--arch/arm/mach-s3c2410/include/mach/dma.h4
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-qt2410.c2
-rw-r--r--arch/arm/mach-s3c2410/pll.c20
-rw-r--r--arch/arm/mach-s3c2410/pm.c36
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c24
-rw-r--r--arch/arm/mach-s3c2412/clock.c2
-rw-r--r--arch/arm/mach-s3c2412/cpu-freq.c13
-rw-r--r--arch/arm/mach-s3c2412/dma.c12
-rw-r--r--arch/arm/mach-s3c2412/irq.c12
-rw-r--r--arch/arm/mach-s3c2412/pm.c12
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c15
-rw-r--r--arch/arm/mach-s3c2416/irq.c12
-rw-r--r--arch/arm/mach-s3c2416/pm.c12
-rw-r--r--arch/arm/mach-s3c2416/s3c2416.c15
-rw-r--r--arch/arm/mach-s3c2440/clock.c15
-rw-r--r--arch/arm/mach-s3c2440/dma.c12
-rw-r--r--arch/arm/mach-s3c2440/irq.c12
-rw-r--r--arch/arm/mach-s3c2440/mach-rx1950.c2
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c2
-rw-r--r--arch/arm/mach-s3c2440/s3c2440-cpufreq.c22
-rw-r--r--arch/arm/mach-s3c2440/s3c2440-pll-12000000.c20
-rw-r--r--arch/arm/mach-s3c2440/s3c2440-pll-16934400.c24
-rw-r--r--arch/arm/mach-s3c2440/s3c2440.c8
-rw-r--r--arch/arm/mach-s3c2440/s3c2442.c17
-rw-r--r--arch/arm/mach-s3c2440/s3c244x-clock.c19
-rw-r--r--arch/arm/mach-s3c2440/s3c244x-irq.c20
-rw-r--r--arch/arm/mach-s3c2440/s3c244x.c16
-rw-r--r--arch/arm/mach-s3c2443/clock.c2
-rw-r--r--arch/arm/mach-s3c2443/dma.c12
-rw-r--r--arch/arm/mach-s3c2443/irq.c12
-rw-r--r--arch/arm/mach-s3c2443/s3c2443.c15
-rw-r--r--arch/arm/mach-s3c64xx/cpu.c19
-rw-r--r--arch/arm/mach-s3c64xx/dma.c23
-rw-r--r--arch/arm/mach-s3c64xx/irq-eint.c2
-rw-r--r--arch/arm/mach-s3c64xx/s3c6400.c15
-rw-r--r--arch/arm/mach-s3c64xx/s3c6410.c15
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c2
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c2
-rw-r--r--arch/arm/mach-s5p64x0/clock.c2
-rw-r--r--arch/arm/mach-s5p64x0/cpu.c15
-rw-r--r--arch/arm/mach-s5p64x0/pm.c10
-rw-r--r--arch/arm/mach-s5pc100/cpu.c15
-rw-r--r--arch/arm/mach-s5pv210/clock.c2
-rw-r--r--arch/arm/mach-s5pv210/cpu.c15
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkc110.c2
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c2
-rw-r--r--arch/arm/mach-s5pv210/pm.c10
-rw-r--r--arch/arm/mach-versatile/core.c1
-rw-r--r--arch/arm/mach-versatile/versatile_ab.c1
-rw-r--r--arch/arm/mach-versatile/versatile_pb.c1
-rw-r--r--arch/arm/mach-vexpress/v2m.c2
-rw-r--r--arch/arm/mach-w90x900/irq.c2
-rw-r--r--arch/arm/plat-s3c24xx/common-smdk.c2
-rw-r--r--arch/arm/plat-s3c24xx/cpu-freq.c2
-rw-r--r--arch/arm/plat-s3c24xx/irq.c2
-rw-r--r--arch/arm/plat-s3c24xx/pm-simtec.c1
-rw-r--r--arch/arm/plat-s3c24xx/s3c2410-clock.c2
-rw-r--r--arch/arm/plat-s3c24xx/s3c2412-iotiming.c2
-rw-r--r--arch/arm/plat-s5p/clock.c2
-rw-r--r--arch/arm/plat-s5p/irq-eint.c2
-rw-r--r--arch/arm/plat-samsung/clock-clksrc.c2
-rw-r--r--arch/arm/plat-samsung/clock.c2
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h28
-rw-r--r--arch/arm/plat-samsung/include/plat/dma-s3c24xx.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/pm.h2
-rw-r--r--arch/arm/plat-samsung/pm-gpio.c2
-rw-r--r--arch/arm/plat-samsung/wakeup-mask.c2
-rw-r--r--arch/avr32/boards/merisc/merisc_sysfs.c1
-rw-r--r--arch/avr32/kernel/cpu.c74
-rw-r--r--arch/avr32/kernel/irq.c2
-rw-r--r--arch/ia64/kernel/err_inject.c52
-rw-r--r--arch/ia64/kernel/topology.c10
-rw-r--r--arch/m68k/platform/coldfire/gpio.c9
-rw-r--r--arch/mips/txx9/generic/7segled.c44
-rw-r--r--arch/mips/txx9/generic/setup.c34
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c2
-rw-r--r--arch/powerpc/include/asm/spu.h12
-rw-r--r--arch/powerpc/include/asm/topology.h10
-rw-r--r--arch/powerpc/kernel/cacheinfo.c10
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kernel/sysfs.c261
-rw-r--r--arch/powerpc/mm/numa.c8
-rw-r--r--arch/powerpc/platforms/cell/cbe_thermal.c144
-rw-r--r--arch/powerpc/platforms/cell/smp.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c61
-rw-r--r--arch/powerpc/platforms/iseries/smp.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c2
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c67
-rw-r--r--arch/powerpc/platforms/pseries/pseries_energy.c71
-rw-r--r--arch/powerpc/platforms/pseries/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/suspend.c33
-rw-r--r--arch/powerpc/sysdev/ppc4xx_cpm.c6
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c12
-rw-r--r--arch/powerpc/sysdev/uic.c1
-rw-r--r--arch/s390/kernel/smp.c76
-rw-r--r--arch/s390/kernel/time.c260
-rw-r--r--arch/s390/kernel/topology.c6
-rw-r--r--arch/sh/drivers/dma/dma-sysfs.c81
-rw-r--r--arch/sh/include/asm/dma.h4
-rw-r--r--arch/sh/kernel/cpu/sh4/sq.c24
-rw-r--r--arch/sparc/kernel/sysfs.c122
-rw-r--r--arch/tile/kernel/sysfs.c61
-rw-r--r--arch/unicore32/kernel/puv3-core.c1
-rw-r--r--arch/unicore32/kernel/puv3-nb0916.c1
-rw-r--r--arch/x86/include/asm/mce.h2
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c25
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-internal.h4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c128
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c11
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c63
-rw-r--r--arch/x86/kernel/hpet.c1
-rw-r--r--arch/x86/kernel/irqinit.c2
-rw-r--r--arch/x86/kernel/microcode_core.c64
-rw-r--r--arch/x86/platform/uv/uv_sysfs.c2
-rw-r--r--drivers/Kconfig4
-rw-r--r--drivers/acpi/processor_driver.c6
-rw-r--r--drivers/acpi/processor_thermal.c1
-rw-r--r--drivers/base/Makefile4
-rw-r--r--drivers/base/base.h12
-rw-r--r--drivers/base/bus.c293
-rw-r--r--drivers/base/class.c14
-rw-r--r--drivers/base/core.c85
-rw-r--r--drivers/base/cpu.c146
-rw-r--r--drivers/base/devtmpfs.c3
-rw-r--r--drivers/base/firmware_class.c14
-rw-r--r--drivers/base/init.c1
-rw-r--r--drivers/base/memory.c160
-rw-r--r--drivers/base/node.c154
-rw-r--r--drivers/base/platform.c2
-rw-r--r--drivers/base/sys.c10
-rw-r--r--drivers/base/topology.c51
-rw-r--r--drivers/bluetooth/ath3k.c14
-rw-r--r--drivers/bluetooth/bcm203x.c21
-rw-r--r--drivers/bluetooth/bfusb.c21
-rw-r--r--drivers/bluetooth/bpa10x.c15
-rw-r--r--drivers/bluetooth/btusb.c15
-rw-r--r--drivers/cpufreq/cpufreq.c79
-rw-r--r--drivers/cpufreq/cpufreq_stats.c1
-rw-r--r--drivers/cpuidle/cpuidle.c12
-rw-r--r--drivers/cpuidle/cpuidle.h10
-rw-r--r--drivers/cpuidle/sysfs.c74
-rw-r--r--drivers/edac/edac_core.h7
-rw-r--r--drivers/edac/edac_device.c1
-rw-r--r--drivers/edac/edac_device_sysfs.c20
-rw-r--r--drivers/edac/edac_mc.c1
-rw-r--r--drivers/edac/edac_mc_sysfs.c16
-rw-r--r--drivers/edac/edac_module.h2
-rw-r--r--drivers/edac/edac_pci.c1
-rw-r--r--drivers/edac/edac_pci_sysfs.c16
-rw-r--r--drivers/edac/edac_stub.c27
-rw-r--r--drivers/edac/mce_amd_inj.c13
-rw-r--r--drivers/firmware/google/gsmi.c3
-rw-r--r--drivers/gpio/gpio-samsung.c2
-rw-r--r--drivers/hid/usbhid/usbkbd.c17
-rw-r--r--drivers/hid/usbhid/usbmouse.c17
-rw-r--r--drivers/hv/Kconfig4
-rw-r--r--drivers/hv/channel_mgmt.c12
-rw-r--r--drivers/hv/hv.c8
-rw-r--r--drivers/hv/hyperv_vmbus.h1
-rw-r--r--drivers/hv/vmbus_drv.c30
-rw-r--r--drivers/i2c/busses/i2c-diolan-u2c.c15
-rw-r--r--drivers/i2c/busses/i2c-tiny-usb.c15
-rw-r--r--drivers/input/joystick/xpad.c13
-rw-r--r--drivers/input/misc/ati_remote2.c21
-rw-r--r--drivers/input/misc/keyspan_remote.c21
-rw-r--r--drivers/input/misc/powermate.c13
-rw-r--r--drivers/input/misc/yealink.c17
-rw-r--r--drivers/input/mouse/appletouch.c13
-rw-r--r--drivers/input/mouse/bcm5974.c14
-rw-r--r--drivers/input/tablet/acecad.c17
-rw-r--r--drivers/input/tablet/aiptek.c19
-rw-r--r--drivers/input/tablet/gtco.c28
-rw-r--r--drivers/input/tablet/hanwang.c13
-rw-r--r--drivers/input/tablet/kbtab.c20
-rw-r--r--drivers/input/tablet/wacom_sys.c19
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c13
-rw-r--r--drivers/isdn/hardware/mISDN/hfcsusb.c28
-rw-r--r--drivers/leds/led-class.c1
-rw-r--r--drivers/leds/led-triggers.c1
-rw-r--r--drivers/macintosh/smu.c4
-rw-r--r--drivers/media/dvb/b2c2/flexcop-usb.c20
-rw-r--r--drivers/media/dvb/dvb-usb/a800.c21
-rw-r--r--drivers/media/dvb/dvb-usb/af9015.c20
-rw-r--r--drivers/media/dvb/dvb-usb/anysee.c21
-rw-r--r--drivers/media/dvb/dvb-usb/au6610.c21
-rw-r--r--drivers/media/dvb/dvb-usb/az6027.c23
-rw-r--r--drivers/media/dvb/dvb-usb/ce6230.c22
-rw-r--r--drivers/media/dvb/dvb-usb/cinergyT2-core.c20
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c22
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-mb.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-mc.c21
-rw-r--r--drivers/media/dvb/dvb-usb/digitv.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dtt200u.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dtv5100.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dw2102.c17
-rw-r--r--drivers/media/dvb/dvb-usb/ec168.c22
-rw-r--r--drivers/media/dvb/dvb-usb/friio.c23
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c21
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.c21
-rw-r--r--drivers/media/dvb/dvb-usb/it913x.c21
-rw-r--r--drivers/media/dvb/dvb-usb/lmedm04.c21
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c22
-rw-r--r--drivers/media/dvb/dvb-usb/mxl111sf.c19
-rw-r--r--drivers/media/dvb/dvb-usb/nova-t-usb2.c21
-rw-r--r--drivers/media/dvb/dvb-usb/opera1.c17
-rw-r--r--drivers/media/dvb/dvb-usb/pctv452e.c17
-rw-r--r--drivers/media/dvb/dvb-usb/technisat-usb2.c20
-rw-r--r--drivers/media/dvb/dvb-usb/ttusb2.c21
-rw-r--r--drivers/media/dvb/dvb-usb/umt-010.c21
-rw-r--r--drivers/media/dvb/dvb-usb/vp702x.c21
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045.c21
-rw-r--r--drivers/media/dvb/siano/smsusb.c21
-rw-r--r--drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c21
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusb_dec.c21
-rw-r--r--drivers/media/radio/dsbr100.c16
-rw-r--r--drivers/media/radio/radio-mr800.c23
-rw-r--r--drivers/media/radio/si470x/radio-si470x-usb.c28
-rw-r--r--drivers/media/rc/ati_remote.c33
-rw-r--r--drivers/media/rc/imon.c21
-rw-r--r--drivers/media/rc/mceusb.c20
-rw-r--r--drivers/media/rc/redrat3.c20
-rw-r--r--drivers/media/rc/streamzap.c28
-rw-r--r--drivers/media/video/cx231xx/cx231xx-cards.c24
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c24
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c25
-rw-r--r--drivers/media/video/gspca/benq.c13
-rw-r--r--drivers/media/video/gspca/conex.c13
-rw-r--r--drivers/media/video/gspca/cpia1.c13
-rw-r--r--drivers/media/video/gspca/etoms.c14
-rw-r--r--drivers/media/video/gspca/finepix.c14
-rw-r--r--drivers/media/video/gspca/gl860/gl860.c17
-rw-r--r--drivers/media/video/gspca/jeilinj.c14
-rw-r--r--drivers/media/video/gspca/kinect.c14
-rw-r--r--drivers/media/video/gspca/konica.c13
-rw-r--r--drivers/media/video/gspca/m5602/m5602_core.c14
-rw-r--r--drivers/media/video/gspca/mars.c13
-rw-r--r--drivers/media/video/gspca/mr97310a.c13
-rw-r--r--drivers/media/video/gspca/nw80x.c13
-rw-r--r--drivers/media/video/gspca/ov519.c13
-rw-r--r--drivers/media/video/gspca/ov534.c14
-rw-r--r--drivers/media/video/gspca/ov534_9.c14
-rw-r--r--drivers/media/video/gspca/pac207.c13
-rw-r--r--drivers/media/video/gspca/pac7302.c13
-rw-r--r--drivers/media/video/gspca/pac7311.c13
-rw-r--r--drivers/media/video/gspca/se401.c13
-rw-r--r--drivers/media/video/gspca/sn9c2028.c14
-rw-r--r--drivers/media/video/gspca/sn9c20x.c13
-rw-r--r--drivers/media/video/gspca/sonixb.c13
-rw-r--r--drivers/media/video/gspca/sonixj.c13
-rw-r--r--drivers/media/video/gspca/spca1528.c13
-rw-r--r--drivers/media/video/gspca/spca500.c13
-rw-r--r--drivers/media/video/gspca/spca501.c13
-rw-r--r--drivers/media/video/gspca/spca505.c13
-rw-r--r--drivers/media/video/gspca/spca506.c19
-rw-r--r--drivers/media/video/gspca/spca508.c13
-rw-r--r--drivers/media/video/gspca/spca561.c13
-rw-r--r--drivers/media/video/gspca/sq905.c14
-rw-r--r--drivers/media/video/gspca/sq905c.c14
-rw-r--r--drivers/media/video/gspca/sq930x.c13
-rw-r--r--drivers/media/video/gspca/stk014.c13
-rw-r--r--drivers/media/video/gspca/stv0680.c13
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx.c13
-rw-r--r--drivers/media/video/gspca/sunplus.c13
-rw-r--r--drivers/media/video/gspca/t613.c13
-rw-r--r--drivers/media/video/gspca/topro.c13
-rw-r--r--drivers/media/video/gspca/tv8532.c14
-rw-r--r--drivers/media/video/gspca/vc032x.c13
-rw-r--r--drivers/media/video/gspca/vicam.c14
-rw-r--r--drivers/media/video/gspca/xirlink_cit.c13
-rw-r--r--drivers/media/video/gspca/zc3xx.c13
-rw-r--r--drivers/media/video/hdpvr/hdpvr-core.c21
-rw-r--r--drivers/media/video/s2255drv.c20
-rw-r--r--drivers/media/video/sn9c102/sn9c102_core.c25
-rw-r--r--drivers/media/video/stk-webcam.c23
-rw-r--r--drivers/media/video/tm6000/tm6000-cards.c26
-rw-r--r--drivers/media/video/zr364xx.c23
-rw-r--r--drivers/mmc/host/ushc.c12
-rw-r--r--drivers/mtd/nand/alauda.c13
-rw-r--r--drivers/net/bonding/bond_sysfs.c1
-rw-r--r--drivers/net/can/usb/ems_usb.c26
-rw-r--r--drivers/net/can/usb/esd_usb2.c23
-rw-r--r--drivers/net/irda/irda-usb.c35
-rw-r--r--drivers/net/irda/kingsun-sir.c19
-rw-r--r--drivers/net/irda/ks959-sir.c21
-rw-r--r--drivers/net/irda/ksdazzle-sir.c21
-rw-r--r--drivers/net/irda/mcs7780.c23
-rw-r--r--drivers/net/irda/stir4200.c19
-rw-r--r--drivers/net/usb/asix.c12
-rw-r--r--drivers/net/usb/catc.c17
-rw-r--r--drivers/net/usb/cdc-phonet.c13
-rw-r--r--drivers/net/usb/cdc_eem.c13
-rw-r--r--drivers/net/usb/cdc_ether.c19
-rw-r--r--drivers/net/usb/cdc_ncm.c15
-rw-r--r--drivers/net/usb/cdc_subset.c12
-rw-r--r--drivers/net/usb/cx82310_eth.c12
-rw-r--r--drivers/net/usb/dm9601.c13
-rw-r--r--drivers/net/usb/gl620a.c12
-rw-r--r--drivers/net/usb/int51x1.c12
-rw-r--r--drivers/net/usb/ipheth.c20
-rw-r--r--drivers/net/usb/kalmia.c12
-rw-r--r--drivers/net/usb/kaweth.c30
-rw-r--r--drivers/net/usb/lg-vl600.c12
-rw-r--r--drivers/net/usb/mcs7830.c12
-rw-r--r--drivers/net/usb/net1080.c12
-rw-r--r--drivers/net/usb/plusb.c12
-rw-r--r--drivers/net/usb/rndis_host.c12
-rw-r--r--drivers/net/usb/rtl8150.c15
-rw-r--r--drivers/net/usb/sierra_net.c19
-rw-r--r--drivers/net/usb/smsc75xx.c12
-rw-r--r--drivers/net/usb/smsc95xx.c12
-rw-r--r--drivers/net/usb/zaurus.c12
-rw-r--r--drivers/net/wireless/ath/carl9170/usb.c13
-rw-r--r--drivers/net/wireless/libertas/if_usb.c24
-rw-r--r--drivers/net/wireless/libertas_tf/if_usb.c22
-rw-r--r--drivers/net/wireless/orinoco/orinoco_usb.c27
-rw-r--r--drivers/net/wireless/p54/p54usb.c13
-rw-r--r--drivers/net/wireless/rndis_wlan.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c13
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c13
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c13
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/dev.c13
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c13
-rw-r--r--drivers/net/wireless/zd1201.c13
-rw-r--r--drivers/nfc/pn533.c19
-rw-r--r--drivers/platform/x86/ibm_rtl.c34
-rw-r--r--drivers/platform/x86/intel_scu_ipc.c2
-rw-r--r--drivers/s390/block/xpram.c2
-rw-r--r--drivers/s390/char/sclp_config.c8
-rw-r--r--drivers/sh/intc/core.c29
-rw-r--r--drivers/sh/intc/internals.h6
-rw-r--r--drivers/sh/intc/userimask.c16
-rw-r--r--drivers/staging/frontier/alphatrack.c28
-rw-r--r--drivers/staging/frontier/tranzport.c27
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_usb.c22
-rw-r--r--drivers/staging/iio/accel/adis16201_core.c13
-rw-r--r--drivers/staging/iio/accel/adis16203_core.c13
-rw-r--r--drivers/staging/iio/accel/adis16204_core.c13
-rw-r--r--drivers/staging/iio/accel/adis16209_core.c13
-rw-r--r--drivers/staging/iio/accel/adis16220_core.c13
-rw-r--r--drivers/staging/iio/accel/adis16240_core.c13
-rw-r--r--drivers/staging/iio/accel/kxsd9.c13
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_core.c13
-rw-r--r--drivers/staging/iio/accel/sca3000_core.c13
-rw-r--r--drivers/staging/iio/adc/ad7192.c13
-rw-r--r--drivers/staging/iio/adc/ad7280a.c13
-rw-r--r--drivers/staging/iio/adc/ad7291.c14
-rw-r--r--drivers/staging/iio/adc/ad7298_core.c13
-rw-r--r--drivers/staging/iio/adc/ad7476_core.c13
-rw-r--r--drivers/staging/iio/adc/ad7606_spi.c13
-rw-r--r--drivers/staging/iio/adc/ad7780.c13
-rw-r--r--drivers/staging/iio/adc/ad7793.c13
-rw-r--r--drivers/staging/iio/adc/ad7816.c14
-rw-r--r--drivers/staging/iio/adc/ad7887_core.c13
-rw-r--r--drivers/staging/iio/adc/ad799x_core.c14
-rw-r--r--drivers/staging/iio/adc/adt7310.c14
-rw-r--r--drivers/staging/iio/adc/adt7410.c14
-rw-r--r--drivers/staging/iio/adc/max1363_core.c14
-rw-r--r--drivers/staging/iio/addac/adt7316-i2c.c14
-rw-r--r--drivers/staging/iio/addac/adt7316-spi.c14
-rw-r--r--drivers/staging/iio/cdc/ad7150.c14
-rw-r--r--drivers/staging/iio/cdc/ad7152.c14
-rw-r--r--drivers/staging/iio/cdc/ad7746.c14
-rw-r--r--drivers/staging/iio/dac/ad5064.c13
-rw-r--r--drivers/staging/iio/dac/ad5360.c13
-rw-r--r--drivers/staging/iio/dac/ad5446.c13
-rw-r--r--drivers/staging/iio/dac/ad5504.c13
-rw-r--r--drivers/staging/iio/dac/ad5624r_spi.c13
-rw-r--r--drivers/staging/iio/dac/ad5686.c13
-rw-r--r--drivers/staging/iio/dac/ad5791.c13
-rw-r--r--drivers/staging/iio/dac/max517.c14
-rw-r--r--drivers/staging/iio/dds/ad5930.c13
-rw-r--r--drivers/staging/iio/dds/ad9832.c13
-rw-r--r--drivers/staging/iio/dds/ad9834.c13
-rw-r--r--drivers/staging/iio/dds/ad9850.c13
-rw-r--r--drivers/staging/iio/dds/ad9852.c13
-rw-r--r--drivers/staging/iio/dds/ad9910.c13
-rw-r--r--drivers/staging/iio/dds/ad9951.c13
-rw-r--r--drivers/staging/iio/gyro/adis16080_core.c13
-rw-r--r--drivers/staging/iio/gyro/adis16130_core.c13
-rw-r--r--drivers/staging/iio/gyro/adis16260_core.c13
-rw-r--r--drivers/staging/iio/gyro/adxrs450_core.c13
-rw-r--r--drivers/staging/iio/impedance-analyzer/ad5933.c13
-rw-r--r--drivers/staging/iio/imu/adis16400_core.c13
-rw-r--r--drivers/staging/iio/light/isl29018.c14
-rw-r--r--drivers/staging/iio/light/tsl2563.c14
-rw-r--r--drivers/staging/iio/light/tsl2583.c14
-rw-r--r--drivers/staging/iio/magnetometer/ak8975.c14
-rw-r--r--drivers/staging/iio/magnetometer/hmc5843.c14
-rw-r--r--drivers/staging/iio/meter/ade7753.c13
-rw-r--r--drivers/staging/iio/meter/ade7754.c13
-rw-r--r--drivers/staging/iio/meter/ade7758_core.c13
-rw-r--r--drivers/staging/iio/meter/ade7759.c13
-rw-r--r--drivers/staging/iio/meter/ade7854-i2c.c14
-rw-r--r--drivers/staging/iio/meter/ade7854-spi.c13
-rw-r--r--drivers/staging/iio/resolver/ad2s1200.c13
-rw-r--r--drivers/staging/iio/resolver/ad2s1210.c13
-rw-r--r--drivers/staging/iio/resolver/ad2s90.c13
-rw-r--r--drivers/staging/keucr/usb.c24
-rw-r--r--drivers/staging/media/go7007/go7007-usb.c15
-rw-r--r--drivers/staging/media/lirc/lirc_igorplugusb.c21
-rw-r--r--drivers/staging/media/lirc/lirc_imon.c24
-rw-r--r--drivers/staging/media/lirc/lirc_sasem.c25
-rw-r--r--drivers/staging/media/lirc/lirc_ttusbir.c22
-rw-r--r--drivers/staging/rts5139/rts51x.c32
-rw-r--r--drivers/staging/vt6656/main_usb.c14
-rw-r--r--drivers/staging/winbond/wbusb.c13
-rw-r--r--drivers/staging/wlan-ng/prism2usb.c14
-rw-r--r--drivers/uio/uio_pdrv.c12
-rw-r--r--drivers/uio/uio_pdrv_genirq.c13
-rw-r--r--drivers/uio/uio_pruss.c14
-rw-r--r--drivers/usb/atm/cxacru.c13
-rw-r--r--drivers/usb/atm/speedtch.c17
-rw-r--r--drivers/usb/atm/ueagle-atm.c31
-rw-r--r--drivers/usb/class/cdc-wdm.c19
-rw-r--r--drivers/usb/class/usblp.c13
-rw-r--r--drivers/usb/class/usbtmc.c17
-rw-r--r--drivers/usb/dwc3/debugfs.c16
-rw-r--r--drivers/usb/host/hwa-hc.c13
-rw-r--r--drivers/usb/image/microtek.c14
-rw-r--r--drivers/usb/misc/adutux.c35
-rw-r--r--drivers/usb/misc/cypress_cy7c63.c22
-rw-r--r--drivers/usb/misc/cytherm.c26
-rw-r--r--drivers/usb/misc/emi26.c13
-rw-r--r--drivers/usb/misc/emi62.c17
-rw-r--r--drivers/usb/misc/idmouse.c24
-rw-r--r--drivers/usb/misc/iowarrior.c13
-rw-r--r--drivers/usb/misc/isight_firmware.c13
-rw-r--r--drivers/usb/misc/ldusb.c27
-rw-r--r--drivers/usb/misc/legousbtower.c46
-rw-r--r--drivers/usb/misc/rio500.c28
-rw-r--r--drivers/usb/misc/trancevibrator.c21
-rw-r--r--drivers/usb/misc/usblcd.c20
-rw-r--r--drivers/usb/misc/usbled.c18
-rw-r--r--drivers/usb/misc/usbsevseg.c18
-rw-r--r--drivers/usb/misc/yurex.c22
-rw-r--r--drivers/usb/storage/alauda.c13
-rw-r--r--drivers/usb/storage/cypress_atacb.c13
-rw-r--r--drivers/usb/storage/datafab.c13
-rw-r--r--drivers/usb/storage/ene_ub6250.c13
-rw-r--r--drivers/usb/storage/freecom.c13
-rw-r--r--drivers/usb/storage/isd200.c13
-rw-r--r--drivers/usb/storage/jumpshot.c13
-rw-r--r--drivers/usb/storage/karma.c13
-rw-r--r--drivers/usb/storage/onetouch.c13
-rw-r--r--drivers/usb/storage/realtek_cr.c13
-rw-r--r--drivers/usb/storage/sddr09.c13
-rw-r--r--drivers/usb/storage/sddr55.c13
-rw-r--r--drivers/usb/storage/shuttle_usbat.c13
-rw-r--r--drivers/usb/storage/uas.c13
-rw-r--r--drivers/usb/usb-skeleton.c21
-rw-r--r--drivers/usb/wusbcore/cbaf.c12
-rw-r--r--drivers/uwb/hwa-rc.c12
-rw-r--r--drivers/uwb/i1480/dfu/usb.c20
-rw-r--r--drivers/video/smscufx.c19
-rw-r--r--drivers/video/udlfb.c19
-rw-r--r--drivers/w1/masters/ds2490.c21
-rw-r--r--drivers/w1/slaves/w1_therm.c36
-rw-r--r--drivers/w1/w1.c10
-rw-r--r--drivers/watchdog/pcwd_usb.c35
-rw-r--r--drivers/xen/xen-balloon.c86
-rw-r--r--drivers/xen/xen-selfballoon.c76
-rw-r--r--fs/debugfs/file.c95
-rw-r--r--include/linux/cpu.h18
-rw-r--r--include/linux/debugfs.h26
-rw-r--r--include/linux/device.h108
-rw-r--r--include/linux/edac.h8
-rw-r--r--include/linux/i2c.h13
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kref.h77
-rw-r--r--include/linux/memory.h3
-rw-r--r--include/linux/node.h6
-rw-r--r--include/linux/platform_device.h14
-rw-r--r--include/linux/spi/spi.h11
-rw-r--r--include/linux/usb.h12
-rw-r--r--include/xen/balloon.h6
-rw-r--r--kernel/rtmutex-tester.c37
-rw-r--r--kernel/sched.c40
-rw-r--r--kernel/time/clockevents.c1
-rw-r--r--kernel/time/clocksource.c37
-rw-r--r--lib/Makefile2
-rw-r--r--lib/devres.c55
-rw-r--r--lib/kobject.c37
-rw-r--r--lib/kobject_uevent.c3
-rw-r--r--lib/kref.c97
-rw-r--r--mm/compaction.c10
-rw-r--r--mm/hugetlb.c34
-rw-r--r--mm/vmscan.c14
-rw-r--r--sound/usb/6fire/chip.c15
-rw-r--r--sound/usb/caiaq/device.c13
-rw-r--r--sound/usb/misc/ua101.c14
-rw-r--r--sound/usb/usx2y/us122l.c14
-rw-r--r--sound/usb/usx2y/usbusx2y.c13
518 files changed, 3168 insertions, 6888 deletions
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index 81bc1a9ab9d8..f7ade3b3b40d 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -275,8 +275,8 @@ versions.
275If no 2.6.x.y kernel is available, then the highest numbered 2.6.x 275If no 2.6.x.y kernel is available, then the highest numbered 2.6.x
276kernel is the current stable kernel. 276kernel is the current stable kernel.
277 277
2782.6.x.y are maintained by the "stable" team <stable@kernel.org>, and are 2782.6.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and
279released as needs dictate. The normal release period is approximately 279are released as needs dictate. The normal release period is approximately
280two weeks, but it can be longer if there are no pressing problems. A 280two weeks, but it can be longer if there are no pressing problems. A
281security-related problem, instead, can cause a release to happen almost 281security-related problem, instead, can cause a release to happen almost
282instantly. 282instantly.
diff --git a/Documentation/development-process/5.Posting b/Documentation/development-process/5.Posting
index 903a2546f138..8a48c9b62864 100644
--- a/Documentation/development-process/5.Posting
+++ b/Documentation/development-process/5.Posting
@@ -271,10 +271,10 @@ copies should go to:
271 the linux-kernel list. 271 the linux-kernel list.
272 272
273 - If you are fixing a bug, think about whether the fix should go into the 273 - If you are fixing a bug, think about whether the fix should go into the
274 next stable update. If so, stable@kernel.org should get a copy of the 274 next stable update. If so, stable@vger.kernel.org should get a copy of
275 patch. Also add a "Cc: stable@kernel.org" to the tags within the patch 275 the patch. Also add a "Cc: stable@vger.kernel.org" to the tags within
276 itself; that will cause the stable team to get a notification when your 276 the patch itself; that will cause the stable team to get a notification
277 fix goes into the mainline. 277 when your fix goes into the mainline.
278 278
279When selecting recipients for a patch, it is good to have an idea of who 279When selecting recipients for a patch, it is good to have an idea of who
280you think will eventually accept the patch and get it merged. While it 280you think will eventually accept the patch and get it merged. While it
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
index d79aead9418b..10c64c8a13d4 100644
--- a/Documentation/driver-model/devres.txt
+++ b/Documentation/driver-model/devres.txt
@@ -262,6 +262,7 @@ IOMAP
262 devm_ioremap() 262 devm_ioremap()
263 devm_ioremap_nocache() 263 devm_ioremap_nocache()
264 devm_iounmap() 264 devm_iounmap()
265 devm_request_and_ioremap() : checks resource, requests region, ioremaps
265 pcim_iomap() 266 pcim_iomap()
266 pcim_iounmap() 267 pcim_iounmap()
267 pcim_iomap_table() : array of mapped addresses indexed by BAR 268 pcim_iomap_table() : array of mapped addresses indexed by BAR
diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt
index 742cc06e138f..f04066a37f4c 100644
--- a/Documentation/filesystems/debugfs.txt
+++ b/Documentation/filesystems/debugfs.txt
@@ -97,7 +97,8 @@ A read on the resulting file will yield either Y (for non-zero values) or
97N, followed by a newline. If written to, it will accept either upper- or 97N, followed by a newline. If written to, it will accept either upper- or
98lower-case values, or 1 or 0. Any other input will be silently ignored. 98lower-case values, or 1 or 0. Any other input will be silently ignored.
99 99
100Finally, a block of arbitrary binary data can be exported with: 100Another option is exporting a block of arbitrary binary data, with
101this structure and function:
101 102
102 struct debugfs_blob_wrapper { 103 struct debugfs_blob_wrapper {
103 void *data; 104 void *data;
@@ -115,6 +116,35 @@ can be used to export binary information, but there does not appear to be
115any code which does so in the mainline. Note that all files created with 116any code which does so in the mainline. Note that all files created with
116debugfs_create_blob() are read-only. 117debugfs_create_blob() are read-only.
117 118
119If you want to dump a block of registers (something that happens quite
120often during development, even if little such code reaches mainline.
121Debugfs offers two functions: one to make a registers-only file, and
122another to insert a register block in the middle of another sequential
123file.
124
125 struct debugfs_reg32 {
126 char *name;
127 unsigned long offset;
128 };
129
130 struct debugfs_regset32 {
131 struct debugfs_reg32 *regs;
132 int nregs;
133 void __iomem *base;
134 };
135
136 struct dentry *debugfs_create_regset32(const char *name, mode_t mode,
137 struct dentry *parent,
138 struct debugfs_regset32 *regset);
139
140 int debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
141 int nregs, void __iomem *base, char *prefix);
142
143The "base" argument may be 0, but you may want to build the reg32 array
144using __stringify, and a number of register names (macros) are actually
145byte offsets over a base for the register block.
146
147
118There are a couple of other directory-oriented helper functions: 148There are a couple of other directory-oriented helper functions:
119 149
120 struct dentry *debugfs_rename(struct dentry *old_dir, 150 struct dentry *debugfs_rename(struct dentry *old_dir,
diff --git a/MAINTAINERS b/MAINTAINERS
index 62f1cd357ddf..f986e7dc904b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6258,7 +6258,7 @@ F: arch/alpha/kernel/srm_env.c
6258 6258
6259STABLE BRANCH 6259STABLE BRANCH
6260M: Greg Kroah-Hartman <greg@kroah.com> 6260M: Greg Kroah-Hartman <greg@kroah.com>
6261L: stable@kernel.org 6261L: stable@vger.kernel.org
6262S: Maintained 6262S: Maintained
6263 6263
6264STAGING SUBSYSTEM 6264STAGING SUBSYSTEM
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index d5adaae5ee2c..f73c908b7fa0 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -10,8 +10,6 @@
10#ifndef __ASM_ARM_MACH_TIME_H 10#ifndef __ASM_ARM_MACH_TIME_H
11#define __ASM_ARM_MACH_TIME_H 11#define __ASM_ARM_MACH_TIME_H
12 12
13#include <linux/sysdev.h>
14
15/* 13/*
16 * This is our kernel timer structure. 14 * This is our kernel timer structure.
17 * 15 *
diff --git a/arch/arm/kernel/leds.c b/arch/arm/kernel/leds.c
index 0bcd38341573..1911dae19e4f 100644
--- a/arch/arm/kernel/leds.c
+++ b/arch/arm/kernel/leds.c
@@ -9,7 +9,7 @@
9 */ 9 */
10#include <linux/export.h> 10#include <linux/export.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/sysdev.h> 12#include <linux/device.h>
13#include <linux/syscore_ops.h> 13#include <linux/syscore_ops.h>
14#include <linux/string.h> 14#include <linux/string.h>
15 15
@@ -34,8 +34,8 @@ static const struct leds_evt_name evt_names[] = {
34 { "red", led_red_on, led_red_off }, 34 { "red", led_red_on, led_red_off },
35}; 35};
36 36
37static ssize_t leds_store(struct sys_device *dev, 37static ssize_t leds_store(struct device *dev,
38 struct sysdev_attribute *attr, 38 struct device_attribute *attr,
39 const char *buf, size_t size) 39 const char *buf, size_t size)
40{ 40{
41 int ret = -EINVAL, len = strcspn(buf, " "); 41 int ret = -EINVAL, len = strcspn(buf, " ");
@@ -69,15 +69,16 @@ static ssize_t leds_store(struct sys_device *dev,
69 return ret; 69 return ret;
70} 70}
71 71
72static SYSDEV_ATTR(event, 0200, NULL, leds_store); 72static DEVICE_ATTR(event, 0200, NULL, leds_store);
73 73
74static struct sysdev_class leds_sysclass = { 74static struct bus_type leds_subsys = {
75 .name = "leds", 75 .name = "leds",
76 .dev_name = "leds",
76}; 77};
77 78
78static struct sys_device leds_device = { 79static struct device leds_device = {
79 .id = 0, 80 .id = 0,
80 .cls = &leds_sysclass, 81 .bus = &leds_subsys,
81}; 82};
82 83
83static int leds_suspend(void) 84static int leds_suspend(void)
@@ -105,11 +106,11 @@ static struct syscore_ops leds_syscore_ops = {
105static int __init leds_init(void) 106static int __init leds_init(void)
106{ 107{
107 int ret; 108 int ret;
108 ret = sysdev_class_register(&leds_sysclass); 109 ret = subsys_system_register(&leds_subsys, NULL);
109 if (ret == 0) 110 if (ret == 0)
110 ret = sysdev_register(&leds_device); 111 ret = device_register(&leds_device);
111 if (ret == 0) 112 if (ret == 0)
112 ret = sysdev_create_file(&leds_device, &attr_event); 113 ret = device_create_file(&leds_device, &dev_attr_event);
113 if (ret == 0) 114 if (ret == 0)
114 register_syscore_ops(&leds_syscore_ops); 115 register_syscore_ops(&leds_syscore_ops);
115 return ret; 116 return ret;
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 430da120a297..6b67b7e8426c 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -25,7 +25,6 @@
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/sysdev.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
30#include <linux/amba/bus.h> 29#include <linux/amba/bus.h>
31#include <linux/clkdev.h> 30#include <linux/clkdev.h>
diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c
index cc8d4bd6d0f7..90a0297b77b8 100644
--- a/arch/arm/mach-exynos/cpu.c
+++ b/arch/arm/mach-exynos/cpu.c
@@ -9,7 +9,7 @@
9*/ 9*/
10 10
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/sysdev.h> 12#include <linux/device.h>
13 13
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15#include <asm/mach/irq.h> 15#include <asm/mach/irq.h>
@@ -238,17 +238,18 @@ void __init exynos4_init_irq(void)
238 s5p_init_irq(NULL, 0); 238 s5p_init_irq(NULL, 0);
239} 239}
240 240
241struct sysdev_class exynos4_sysclass = { 241struct bus_type exynos4_subsys = {
242 .name = "exynos4-core", 242 .name = "exynos4-core",
243 .dev_name = "exynos4-core",
243}; 244};
244 245
245static struct sys_device exynos4_sysdev = { 246static struct device exynos4_dev = {
246 .cls = &exynos4_sysclass, 247 .bus = &exynos4_subsys,
247}; 248};
248 249
249static int __init exynos4_core_init(void) 250static int __init exynos4_core_init(void)
250{ 251{
251 return sysdev_class_register(&exynos4_sysclass); 252 return subsys_system_register(&exynos4_subsys, NULL);
252} 253}
253core_initcall(exynos4_core_init); 254core_initcall(exynos4_core_init);
254 255
@@ -289,5 +290,5 @@ int __init exynos_init(void)
289 if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412()) 290 if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412())
290 s5p_reset_hook = exynos4_sw_reset; 291 s5p_reset_hook = exynos4_sw_reset;
291 292
292 return sysdev_register(&exynos4_sysdev); 293 return device_register(&exynos4_dev);
293} 294}
diff --git a/arch/arm/mach-exynos/irq-eint.c b/arch/arm/mach-exynos/irq-eint.c
index badb8c66fc9b..fe461901d60f 100644
--- a/arch/arm/mach-exynos/irq-eint.c
+++ b/arch/arm/mach-exynos/irq-eint.c
@@ -14,7 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19 19
20#include <plat/pm.h> 20#include <plat/pm.h>
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 509a435afd4b..c4f792dcad19 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -205,7 +205,7 @@ static void exynos4_pm_prepare(void)
205 205
206} 206}
207 207
208static int exynos4_pm_add(struct sys_device *sysdev) 208static int exynos4_pm_add(struct device *dev)
209{ 209{
210 pm_cpu_prep = exynos4_pm_prepare; 210 pm_cpu_prep = exynos4_pm_prepare;
211 pm_cpu_sleep = exynos4_cpu_suspend; 211 pm_cpu_sleep = exynos4_cpu_suspend;
@@ -301,8 +301,10 @@ static void exynos4_restore_pll(void)
301 } while (epll_wait || vpll_wait); 301 } while (epll_wait || vpll_wait);
302} 302}
303 303
304static struct sysdev_driver exynos4_pm_driver = { 304static struct subsys_interface exynos4_pm_interface = {
305 .add = exynos4_pm_add, 305 .name = "exynos4_pm",
306 .subsys = &exynos4_subsys,
307 .add_dev = exynos4_pm_add,
306}; 308};
307 309
308static __init int exynos4_pm_drvinit(void) 310static __init int exynos4_pm_drvinit(void)
@@ -325,7 +327,7 @@ static __init int exynos4_pm_drvinit(void)
325 clk_put(pll_base); 327 clk_put(pll_base);
326 } 328 }
327 329
328 return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver); 330 return subsys_interface_register(&exynos4_pm_interface);
329} 331}
330arch_initcall(exynos4_pm_drvinit); 332arch_initcall(exynos4_pm_drvinit);
331 333
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 5de49c33e4d4..208545c53da6 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -14,7 +14,7 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/amba/bus.h> 18#include <linux/amba/bus.h>
19#include <linux/amba/kmi.h> 19#include <linux/amba/kmi.h>
20#include <linux/amba/clcd.h> 20#include <linux/amba/clcd.h>
diff --git a/arch/arm/mach-ks8695/irq.c b/arch/arm/mach-ks8695/irq.c
index a78092dcd6fb..76802aac0f45 100644
--- a/arch/arm/mach-ks8695/irq.c
+++ b/arch/arm/mach-ks8695/irq.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/io.h> 27#include <linux/io.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 6d2f0d1b9373..21f3d4b9ee85 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -18,7 +18,7 @@
18 18
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/sysdev.h> 21#include <linux/device.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c
index 32b465763dbd..97b8191d9d38 100644
--- a/arch/arm/mach-msm/board-sapphire.c
+++ b/arch/arm/mach-msm/board-sapphire.c
@@ -18,7 +18,7 @@
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/sysdev.h> 21#include <linux/device.h>
22 22
23#include <linux/delay.h> 23#include <linux/delay.h>
24 24
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index d5ed5d4f77d6..acd329afc3ac 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -21,7 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/sysdev.h> 24#include <linux/device.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/amba/bus.h> 26#include <linux/amba/bus.h>
27#include <linux/amba/clcd.h> 27#include <linux/amba/clcd.h>
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 026c66ad7ec2..af608f76e0a7 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -21,7 +21,7 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/sysdev.h> 24#include <linux/device.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index c057540ec776..510424669d0e 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -21,7 +21,7 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/sysdev.h> 24#include <linux/device.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 671ad6d6ff00..70d1bbdf2a3e 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -21,7 +21,7 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/sysdev.h> 24#include <linux/device.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index cbf22df4ad5b..b841fc0a75dc 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -21,7 +21,7 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/sysdev.h> 24#include <linux/device.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 63c4114afae9..e102120fc6ac 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -20,7 +20,7 @@
20 20
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/sysdev.h> 23#include <linux/device.h>
24#include <linux/amba/bus.h> 24#include <linux/amba/bus.h>
25#include <linux/amba/pl061.h> 25#include <linux/amba/pl061.h>
26#include <linux/amba/mmci.h> 26#include <linux/amba/mmci.h>
diff --git a/arch/arm/mach-s3c2410/bast-irq.c b/arch/arm/mach-s3c2410/bast-irq.c
index bc53d2d16d1a..ac7b2ad5c405 100644
--- a/arch/arm/mach-s3c2410/bast-irq.c
+++ b/arch/arm/mach-s3c2410/bast-irq.c
@@ -24,7 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/sysdev.h> 27#include <linux/device.h>
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
diff --git a/arch/arm/mach-s3c2410/cpu-freq.c b/arch/arm/mach-s3c2410/cpu-freq.c
index 75189df995ae..7dc6c46b5e2b 100644
--- a/arch/arm/mach-s3c2410/cpu-freq.c
+++ b/arch/arm/mach-s3c2410/cpu-freq.c
@@ -16,7 +16,7 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/sysdev.h> 19#include <linux/device.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/io.h> 22#include <linux/io.h>
@@ -115,24 +115,25 @@ static struct s3c_cpufreq_info s3c2410_cpufreq_info = {
115 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs), 115 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs),
116}; 116};
117 117
118static int s3c2410_cpufreq_add(struct sys_device *sysdev) 118static int s3c2410_cpufreq_add(struct device *dev)
119{ 119{
120 return s3c_cpufreq_register(&s3c2410_cpufreq_info); 120 return s3c_cpufreq_register(&s3c2410_cpufreq_info);
121} 121}
122 122
123static struct sysdev_driver s3c2410_cpufreq_driver = { 123static struct subsys_interface s3c2410_cpufreq_interface = {
124 .add = s3c2410_cpufreq_add, 124 .name = "s3c2410_cpufreq",
125 .subsys = &s3c2410_subsys,
126 .add_dev = s3c2410_cpufreq_add,
125}; 127};
126 128
127static int __init s3c2410_cpufreq_init(void) 129static int __init s3c2410_cpufreq_init(void)
128{ 130{
129 return sysdev_driver_register(&s3c2410_sysclass, 131 return subsys_interface_register(&s3c2410_cpufreq_interface);
130 &s3c2410_cpufreq_driver);
131} 132}
132 133
133arch_initcall(s3c2410_cpufreq_init); 134arch_initcall(s3c2410_cpufreq_init);
134 135
135static int s3c2410a_cpufreq_add(struct sys_device *sysdev) 136static int s3c2410a_cpufreq_add(struct device *dev)
136{ 137{
137 /* alter the maximum freq settings for S3C2410A. If a board knows 138 /* alter the maximum freq settings for S3C2410A. If a board knows
138 * it only has a maximum of 200, then it should register its own 139 * it only has a maximum of 200, then it should register its own
@@ -143,17 +144,18 @@ static int s3c2410a_cpufreq_add(struct sys_device *sysdev)
143 s3c2410_cpufreq_info.max.pclk = 66500000; 144 s3c2410_cpufreq_info.max.pclk = 66500000;
144 s3c2410_cpufreq_info.name = "s3c2410a"; 145 s3c2410_cpufreq_info.name = "s3c2410a";
145 146
146 return s3c2410_cpufreq_add(sysdev); 147 return s3c2410_cpufreq_add(dev);
147} 148}
148 149
149static struct sysdev_driver s3c2410a_cpufreq_driver = { 150static struct subsys_interface s3c2410a_cpufreq_interface = {
150 .add = s3c2410a_cpufreq_add, 151 .name = "s3c2410a_cpufreq",
152 .subsys = &s3c2410a_subsys,
153 .add_dev = s3c2410a_cpufreq_add,
151}; 154};
152 155
153static int __init s3c2410a_cpufreq_init(void) 156static int __init s3c2410a_cpufreq_init(void)
154{ 157{
155 return sysdev_driver_register(&s3c2410a_sysclass, 158 return subsys_interface_register(&s3c2410a_cpufreq_interface);
156 &s3c2410a_cpufreq_driver);
157} 159}
158 160
159arch_initcall(s3c2410a_cpufreq_init); 161arch_initcall(s3c2410a_cpufreq_init);
diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
index dbe43df8cfec..2afd00014a77 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c2410/dma.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19 19
20#include <mach/map.h> 20#include <mach/map.h>
@@ -132,7 +132,7 @@ static struct s3c24xx_dma_order __initdata s3c2410_dma_order = {
132 }, 132 },
133}; 133};
134 134
135static int __init s3c2410_dma_add(struct sys_device *sysdev) 135static int __init s3c2410_dma_add(struct device *dev)
136{ 136{
137 s3c2410_dma_init(); 137 s3c2410_dma_init();
138 s3c24xx_dma_order_set(&s3c2410_dma_order); 138 s3c24xx_dma_order_set(&s3c2410_dma_order);
@@ -140,24 +140,28 @@ static int __init s3c2410_dma_add(struct sys_device *sysdev)
140} 140}
141 141
142#if defined(CONFIG_CPU_S3C2410) 142#if defined(CONFIG_CPU_S3C2410)
143static struct sysdev_driver s3c2410_dma_driver = { 143static struct subsys_interface s3c2410_dma_interface = {
144 .add = s3c2410_dma_add, 144 .name = "s3c2410_dma",
145 .subsys = &s3c2410_subsys,
146 .add_dev = s3c2410_dma_add,
145}; 147};
146 148
147static int __init s3c2410_dma_drvinit(void) 149static int __init s3c2410_dma_drvinit(void)
148{ 150{
149 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_dma_driver); 151 return subsys_interface_register(&s3c2410_interface);
150} 152}
151 153
152arch_initcall(s3c2410_dma_drvinit); 154arch_initcall(s3c2410_dma_drvinit);
153 155
154static struct sysdev_driver s3c2410a_dma_driver = { 156static struct subsys_interface s3c2410a_dma_interface = {
155 .add = s3c2410_dma_add, 157 .name = "s3c2410a_dma",
158 .subsys = &s3c2410a_subsys,
159 .add_dev = s3c2410_dma_add,
156}; 160};
157 161
158static int __init s3c2410a_dma_drvinit(void) 162static int __init s3c2410a_dma_drvinit(void)
159{ 163{
160 return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_dma_driver); 164 return subsys_interface_register(&s3c2410a_dma_interface);
161} 165}
162 166
163arch_initcall(s3c2410a_dma_drvinit); 167arch_initcall(s3c2410a_dma_drvinit);
@@ -165,13 +169,15 @@ arch_initcall(s3c2410a_dma_drvinit);
165 169
166#if defined(CONFIG_CPU_S3C2442) 170#if defined(CONFIG_CPU_S3C2442)
167/* S3C2442 DMA contains the same selection table as the S3C2410 */ 171/* S3C2442 DMA contains the same selection table as the S3C2410 */
168static struct sysdev_driver s3c2442_dma_driver = { 172static struct subsys_interface s3c2442_dma_interface = {
169 .add = s3c2410_dma_add, 173 .name = "s3c2442_dma",
174 .subsys = &s3c2442_subsys,
175 .add_dev = s3c2410_dma_add,
170}; 176};
171 177
172static int __init s3c2442_dma_drvinit(void) 178static int __init s3c2442_dma_drvinit(void)
173{ 179{
174 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_dma_driver); 180 return subsys_interface_register(&s3c2442_dma_interface);
175} 181}
176 182
177arch_initcall(s3c2442_dma_drvinit); 183arch_initcall(s3c2442_dma_drvinit);
diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h b/arch/arm/mach-s3c2410/include/mach/dma.h
index ae8e482b6427..acbdfecd4186 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -13,7 +13,7 @@
13#ifndef __ASM_ARCH_DMA_H 13#ifndef __ASM_ARCH_DMA_H
14#define __ASM_ARCH_DMA_H __FILE__ 14#define __ASM_ARCH_DMA_H __FILE__
15 15
16#include <linux/sysdev.h> 16#include <linux/device.h>
17 17
18#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ 18#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */
19 19
@@ -202,7 +202,7 @@ struct s3c2410_dma_chan {
202 struct s3c2410_dma_buf *end; /* end of queue */ 202 struct s3c2410_dma_buf *end; /* end of queue */
203 203
204 /* system device */ 204 /* system device */
205 struct sys_device dev; 205 struct device dev;
206}; 206};
207 207
208typedef unsigned long dma_device_t; 208typedef unsigned long dma_device_t;
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 05a7d16e59f5..837a2d6f3524 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -18,7 +18,7 @@
18#include <linux/memblock.h> 18#include <linux/memblock.h>
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/sysdev.h> 21#include <linux/device.h>
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/io.h> 24#include <linux/io.h>
diff --git a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c
index 451852156254..6f69789943d5 100644
--- a/arch/arm/mach-s3c2410/mach-qt2410.c
+++ b/arch/arm/mach-s3c2410/mach-qt2410.c
@@ -28,7 +28,7 @@
28#include <linux/timer.h> 28#include <linux/timer.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/gpio.h> 30#include <linux/gpio.h>
31#include <linux/sysdev.h> 31#include <linux/device.h>
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/serial_core.h> 33#include <linux/serial_core.h>
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
diff --git a/arch/arm/mach-s3c2410/pll.c b/arch/arm/mach-s3c2410/pll.c
index 8338865e11c0..c07438bfc99f 100644
--- a/arch/arm/mach-s3c2410/pll.c
+++ b/arch/arm/mach-s3c2410/pll.c
@@ -25,7 +25,7 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/sysdev.h> 28#include <linux/device.h>
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/err.h> 31#include <linux/err.h>
@@ -66,30 +66,34 @@ static struct cpufreq_frequency_table pll_vals_12MHz[] = {
66 { .frequency = 270000000, .index = PLLVAL(127, 1, 1), }, 66 { .frequency = 270000000, .index = PLLVAL(127, 1, 1), },
67}; 67};
68 68
69static int s3c2410_plls_add(struct sys_device *dev) 69static int s3c2410_plls_add(struct device *dev)
70{ 70{
71 return s3c_plltab_register(pll_vals_12MHz, ARRAY_SIZE(pll_vals_12MHz)); 71 return s3c_plltab_register(pll_vals_12MHz, ARRAY_SIZE(pll_vals_12MHz));
72} 72}
73 73
74static struct sysdev_driver s3c2410_plls_drv = { 74static struct subsys_interface s3c2410_plls_interface = {
75 .add = s3c2410_plls_add, 75 .name = "s3c2410_plls",
76 .subsys = &s3c2410_subsys,
77 .add_dev = s3c2410_plls_add,
76}; 78};
77 79
78static int __init s3c2410_pll_init(void) 80static int __init s3c2410_pll_init(void)
79{ 81{
80 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_plls_drv); 82 return subsys_interface_register(&s3c2410_plls_interface);
81 83
82} 84}
83 85
84arch_initcall(s3c2410_pll_init); 86arch_initcall(s3c2410_pll_init);
85 87
86static struct sysdev_driver s3c2410a_plls_drv = { 88static struct subsys_interface s3c2410a_plls_interface = {
87 .add = s3c2410_plls_add, 89 .name = "s3c2410a_plls",
90 .subsys = &s3c2410a_subsys,
91 .add_dev = s3c2410_plls_add,
88}; 92};
89 93
90static int __init s3c2410a_pll_init(void) 94static int __init s3c2410a_pll_init(void)
91{ 95{
92 return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_plls_drv); 96 return subsys_interface_register(&s3c2410a_plls_interface);
93} 97}
94 98
95arch_initcall(s3c2410a_pll_init); 99arch_initcall(s3c2410a_pll_init);
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c
index 4728f9aa7df1..fda5385deff6 100644
--- a/arch/arm/mach-s3c2410/pm.c
+++ b/arch/arm/mach-s3c2410/pm.c
@@ -24,7 +24,7 @@
24#include <linux/suspend.h> 24#include <linux/suspend.h>
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/time.h> 26#include <linux/time.h>
27#include <linux/sysdev.h> 27#include <linux/device.h>
28#include <linux/syscore_ops.h> 28#include <linux/syscore_ops.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/io.h> 30#include <linux/io.h>
@@ -111,7 +111,7 @@ struct syscore_ops s3c2410_pm_syscore_ops = {
111 .resume = s3c2410_pm_resume, 111 .resume = s3c2410_pm_resume,
112}; 112};
113 113
114static int s3c2410_pm_add(struct sys_device *dev) 114static int s3c2410_pm_add(struct device *dev)
115{ 115{
116 pm_cpu_prep = s3c2410_pm_prepare; 116 pm_cpu_prep = s3c2410_pm_prepare;
117 pm_cpu_sleep = s3c2410_cpu_suspend; 117 pm_cpu_sleep = s3c2410_cpu_suspend;
@@ -120,52 +120,60 @@ static int s3c2410_pm_add(struct sys_device *dev)
120} 120}
121 121
122#if defined(CONFIG_CPU_S3C2410) 122#if defined(CONFIG_CPU_S3C2410)
123static struct sysdev_driver s3c2410_pm_driver = { 123static struct subsys_interface s3c2410_pm_interface = {
124 .add = s3c2410_pm_add, 124 .name = "s3c2410_pm",
125 .subsys = &s3c2410_subsys,
126 .add_dev = s3c2410_pm_add,
125}; 127};
126 128
127/* register ourselves */ 129/* register ourselves */
128 130
129static int __init s3c2410_pm_drvinit(void) 131static int __init s3c2410_pm_drvinit(void)
130{ 132{
131 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_pm_driver); 133 return subsys_interface_register(&s3c2410_pm_interface);
132} 134}
133 135
134arch_initcall(s3c2410_pm_drvinit); 136arch_initcall(s3c2410_pm_drvinit);
135 137
136static struct sysdev_driver s3c2410a_pm_driver = { 138static struct subsys_interface s3c2410a_pm_interface = {
137 .add = s3c2410_pm_add, 139 .name = "s3c2410a_pm",
140 .subsys = &s3c2410a_subsys,
141 .add_dev = s3c2410_pm_add,
138}; 142};
139 143
140static int __init s3c2410a_pm_drvinit(void) 144static int __init s3c2410a_pm_drvinit(void)
141{ 145{
142 return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_pm_driver); 146 return subsys_interface_register(&s3c2410a_pm_interface);
143} 147}
144 148
145arch_initcall(s3c2410a_pm_drvinit); 149arch_initcall(s3c2410a_pm_drvinit);
146#endif 150#endif
147 151
148#if defined(CONFIG_CPU_S3C2440) 152#if defined(CONFIG_CPU_S3C2440)
149static struct sysdev_driver s3c2440_pm_driver = { 153static struct subsys_interface s3c2440_pm_interface = {
150 .add = s3c2410_pm_add, 154 .name = "s3c2440_pm",
155 .subsys = &s3c2440_subsys,
156 .add_dev = s3c2410_pm_add,
151}; 157};
152 158
153static int __init s3c2440_pm_drvinit(void) 159static int __init s3c2440_pm_drvinit(void)
154{ 160{
155 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_pm_driver); 161 return subsys_interface_register(&s3c2440_pm_interface);
156} 162}
157 163
158arch_initcall(s3c2440_pm_drvinit); 164arch_initcall(s3c2440_pm_drvinit);
159#endif 165#endif
160 166
161#if defined(CONFIG_CPU_S3C2442) 167#if defined(CONFIG_CPU_S3C2442)
162static struct sysdev_driver s3c2442_pm_driver = { 168static struct subsys_interface s3c2442_pm_interface = {
163 .add = s3c2410_pm_add, 169 .name = "s3c2442_pm",
170 .subsys = &s3c2442_subsys,
171 .add_dev = s3c2410_pm_add,
164}; 172};
165 173
166static int __init s3c2442_pm_drvinit(void) 174static int __init s3c2442_pm_drvinit(void)
167{ 175{
168 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_pm_driver); 176 return subsys_interface_register(&s3c2442_pm_interface);
169} 177}
170 178
171arch_initcall(s3c2442_pm_drvinit); 179arch_initcall(s3c2442_pm_drvinit);
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index 3d7ebc557a72..da6651556eb9 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/sysdev.h> 21#include <linux/device.h>
22#include <linux/syscore_ops.h> 22#include <linux/syscore_ops.h>
23#include <linux/serial_core.h> 23#include <linux/serial_core.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
@@ -131,22 +131,24 @@ void __init s3c2410_init_clocks(int xtal)
131 s3c24xx_register_clock(&s3c2410_armclk); 131 s3c24xx_register_clock(&s3c2410_armclk);
132} 132}
133 133
134struct sysdev_class s3c2410_sysclass = { 134struct bus_type s3c2410_subsys = {
135 .name = "s3c2410-core", 135 .name = "s3c2410-core",
136 .dev_name = "s3c2410-core",
136}; 137};
137 138
138/* Note, we would have liked to name this s3c2410-core, but we cannot 139/* Note, we would have liked to name this s3c2410-core, but we cannot
139 * register two sysdev_class with the same name. 140 * register two subsystems with the same name.
140 */ 141 */
141struct sysdev_class s3c2410a_sysclass = { 142struct bus_type s3c2410a_subsys = {
142 .name = "s3c2410a-core", 143 .name = "s3c2410a-core",
144 .dev_name = "s3c2410a-core",
143}; 145};
144 146
145static struct sys_device s3c2410_sysdev = { 147static struct device s3c2410_dev = {
146 .cls = &s3c2410_sysclass, 148 .bus = &s3c2410_subsys,
147}; 149};
148 150
149/* need to register class before we actually register the device, and 151/* need to register the subsystem before we actually register the device, and
150 * we also need to ensure that it has been initialised before any of the 152 * we also need to ensure that it has been initialised before any of the
151 * drivers even try to use it (even if not on an s3c2410 based system) 153 * drivers even try to use it (even if not on an s3c2410 based system)
152 * as a driver which may support both 2410 and 2440 may try and use it. 154 * as a driver which may support both 2410 and 2440 may try and use it.
@@ -154,14 +156,14 @@ static struct sys_device s3c2410_sysdev = {
154 156
155static int __init s3c2410_core_init(void) 157static int __init s3c2410_core_init(void)
156{ 158{
157 return sysdev_class_register(&s3c2410_sysclass); 159 return subsys_system_register(&s3c2410_subsys, NULL);
158} 160}
159 161
160core_initcall(s3c2410_core_init); 162core_initcall(s3c2410_core_init);
161 163
162static int __init s3c2410a_core_init(void) 164static int __init s3c2410a_core_init(void)
163{ 165{
164 return sysdev_class_register(&s3c2410a_sysclass); 166 return subsys_system_register(&s3c2410a_subsys, NULL);
165} 167}
166 168
167core_initcall(s3c2410a_core_init); 169core_initcall(s3c2410a_core_init);
@@ -175,11 +177,11 @@ int __init s3c2410_init(void)
175#endif 177#endif
176 register_syscore_ops(&s3c24xx_irq_syscore_ops); 178 register_syscore_ops(&s3c24xx_irq_syscore_ops);
177 179
178 return sysdev_register(&s3c2410_sysdev); 180 return device_register(&s3c2410_dev);
179} 181}
180 182
181int __init s3c2410a_init(void) 183int __init s3c2410a_init(void)
182{ 184{
183 s3c2410_sysdev.cls = &s3c2410a_sysclass; 185 s3c2410_dev.bus = &s3c2410a_subsys;
184 return s3c2410_init(); 186 return s3c2410_init();
185} 187}
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 140711db6c89..516881640808 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -26,7 +26,7 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/sysdev.h> 29#include <linux/device.h>
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
diff --git a/arch/arm/mach-s3c2412/cpu-freq.c b/arch/arm/mach-s3c2412/cpu-freq.c
index eb3ea1721335..d8664b7652ce 100644
--- a/arch/arm/mach-s3c2412/cpu-freq.c
+++ b/arch/arm/mach-s3c2412/cpu-freq.c
@@ -16,7 +16,7 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/sysdev.h> 19#include <linux/device.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/err.h> 22#include <linux/err.h>
@@ -194,7 +194,7 @@ static struct s3c_cpufreq_info s3c2412_cpufreq_info = {
194 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2412_iotiming_debugfs), 194 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2412_iotiming_debugfs),
195}; 195};
196 196
197static int s3c2412_cpufreq_add(struct sys_device *sysdev) 197static int s3c2412_cpufreq_add(struct device *dev)
198{ 198{
199 unsigned long fclk_rate; 199 unsigned long fclk_rate;
200 200
@@ -244,14 +244,15 @@ err_fclk:
244 return -ENOENT; 244 return -ENOENT;
245} 245}
246 246
247static struct sysdev_driver s3c2412_cpufreq_driver = { 247static struct subsys_interface s3c2412_cpufreq_interface = {
248 .add = s3c2412_cpufreq_add, 248 .name = "s3c2412_cpufreq",
249 .subsys = &s3c2412_subsys,
250 .add_dev = s3c2412_cpufreq_add,
249}; 251};
250 252
251static int s3c2412_cpufreq_init(void) 253static int s3c2412_cpufreq_init(void)
252{ 254{
253 return sysdev_driver_register(&s3c2412_sysclass, 255 return subsys_interface_register(&s3c2412_cpufreq_interface);
254 &s3c2412_cpufreq_driver);
255} 256}
256 257
257arch_initcall(s3c2412_cpufreq_init); 258arch_initcall(s3c2412_cpufreq_init);
diff --git a/arch/arm/mach-s3c2412/dma.c b/arch/arm/mach-s3c2412/dma.c
index d2a7d5ef3e67..142acd3b5e15 100644
--- a/arch/arm/mach-s3c2412/dma.c
+++ b/arch/arm/mach-s3c2412/dma.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
@@ -159,19 +159,21 @@ static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = {
159 .map_size = ARRAY_SIZE(s3c2412_dma_mappings), 159 .map_size = ARRAY_SIZE(s3c2412_dma_mappings),
160}; 160};
161 161
162static int __init s3c2412_dma_add(struct sys_device *sysdev) 162static int __init s3c2412_dma_add(struct device *dev)
163{ 163{
164 s3c2410_dma_init(); 164 s3c2410_dma_init();
165 return s3c24xx_dma_init_map(&s3c2412_dma_sel); 165 return s3c24xx_dma_init_map(&s3c2412_dma_sel);
166} 166}
167 167
168static struct sysdev_driver s3c2412_dma_driver = { 168static struct subsys_interface s3c2412_dma_interface = {
169 .add = s3c2412_dma_add, 169 .name = "s3c2412_dma",
170 .subsys = &s3c2412_subsys,
171 .add_dev = s3c2412_dma_add,
170}; 172};
171 173
172static int __init s3c2412_dma_init(void) 174static int __init s3c2412_dma_init(void)
173{ 175{
174 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_dma_driver); 176 return subsys_interface_register(&s3c2412_dma_interface);
175} 177}
176 178
177arch_initcall(s3c2412_dma_init); 179arch_initcall(s3c2412_dma_init);
diff --git a/arch/arm/mach-s3c2412/irq.c b/arch/arm/mach-s3c2412/irq.c
index 1a1aa220972b..a8a46c1644f4 100644
--- a/arch/arm/mach-s3c2412/irq.c
+++ b/arch/arm/mach-s3c2412/irq.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/io.h> 27#include <linux/io.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
@@ -170,7 +170,7 @@ static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state)
170 170
171static struct irq_chip s3c2412_irq_rtc_chip; 171static struct irq_chip s3c2412_irq_rtc_chip;
172 172
173static int s3c2412_irq_add(struct sys_device *sysdev) 173static int s3c2412_irq_add(struct device *dev)
174{ 174{
175 unsigned int irqno; 175 unsigned int irqno;
176 176
@@ -200,13 +200,15 @@ static int s3c2412_irq_add(struct sys_device *sysdev)
200 return 0; 200 return 0;
201} 201}
202 202
203static struct sysdev_driver s3c2412_irq_driver = { 203static struct subsys_interface s3c2412_irq_interface = {
204 .add = s3c2412_irq_add, 204 .name = "s3c2412_irq",
205 .subsys = &s3c2412_subsys,
206 .add_dev = s3c2412_irq_add,
205}; 207};
206 208
207static int s3c2412_irq_init(void) 209static int s3c2412_irq_init(void)
208{ 210{
209 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_irq_driver); 211 return subsys_interface_register(&s3c2412_irq_interface);
210} 212}
211 213
212arch_initcall(s3c2412_irq_init); 214arch_initcall(s3c2412_irq_init);
diff --git a/arch/arm/mach-s3c2412/pm.c b/arch/arm/mach-s3c2412/pm.c
index f4077efa51fa..d1adfa65f66d 100644
--- a/arch/arm/mach-s3c2412/pm.c
+++ b/arch/arm/mach-s3c2412/pm.c
@@ -16,7 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/sysdev.h> 19#include <linux/device.h>
20#include <linux/syscore_ops.h> 20#include <linux/syscore_ops.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/io.h> 22#include <linux/io.h>
@@ -56,7 +56,7 @@ static void s3c2412_pm_prepare(void)
56{ 56{
57} 57}
58 58
59static int s3c2412_pm_add(struct sys_device *sysdev) 59static int s3c2412_pm_add(struct device *dev)
60{ 60{
61 pm_cpu_prep = s3c2412_pm_prepare; 61 pm_cpu_prep = s3c2412_pm_prepare;
62 pm_cpu_sleep = s3c2412_cpu_suspend; 62 pm_cpu_sleep = s3c2412_cpu_suspend;
@@ -87,13 +87,15 @@ static struct sleep_save s3c2412_sleep[] = {
87 SAVE_ITEM(S3C2413_GPJSLPCON), 87 SAVE_ITEM(S3C2413_GPJSLPCON),
88}; 88};
89 89
90static struct sysdev_driver s3c2412_pm_driver = { 90static struct subsys_interface s3c2412_pm_interface = {
91 .add = s3c2412_pm_add, 91 .name = "s3c2412_pm",
92 .subsys = &s3c2412_subsys,
93 .add_dev = s3c2412_pm_add,
92}; 94};
93 95
94static __init int s3c2412_pm_init(void) 96static __init int s3c2412_pm_init(void)
95{ 97{
96 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver); 98 return subsys_interface_register(&s3c2412_pm_interface);
97} 99}
98 100
99arch_initcall(s3c2412_pm_init); 101arch_initcall(s3c2412_pm_init);
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index 57a1e01e4e50..6c7253ffc5bc 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/sysdev.h> 21#include <linux/device.h>
22#include <linux/syscore_ops.h> 22#include <linux/syscore_ops.h>
23#include <linux/serial_core.h> 23#include <linux/serial_core.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
@@ -220,25 +220,26 @@ void __init s3c2412_init_clocks(int xtal)
220 s3c2412_baseclk_add(); 220 s3c2412_baseclk_add();
221} 221}
222 222
223/* need to register class before we actually register the device, and 223/* need to register the subsystem before we actually register the device, and
224 * we also need to ensure that it has been initialised before any of the 224 * we also need to ensure that it has been initialised before any of the
225 * drivers even try to use it (even if not on an s3c2412 based system) 225 * drivers even try to use it (even if not on an s3c2412 based system)
226 * as a driver which may support both 2410 and 2440 may try and use it. 226 * as a driver which may support both 2410 and 2440 may try and use it.
227*/ 227*/
228 228
229struct sysdev_class s3c2412_sysclass = { 229struct bus_type s3c2412_subsys = {
230 .name = "s3c2412-core", 230 .name = "s3c2412-core",
231 .dev_name = "s3c2412-core",
231}; 232};
232 233
233static int __init s3c2412_core_init(void) 234static int __init s3c2412_core_init(void)
234{ 235{
235 return sysdev_class_register(&s3c2412_sysclass); 236 return subsys_system_register(&s3c2412_subsys, NULL);
236} 237}
237 238
238core_initcall(s3c2412_core_init); 239core_initcall(s3c2412_core_init);
239 240
240static struct sys_device s3c2412_sysdev = { 241static struct device s3c2412_dev = {
241 .cls = &s3c2412_sysclass, 242 .bus = &s3c2412_subsys,
242}; 243};
243 244
244int __init s3c2412_init(void) 245int __init s3c2412_init(void)
@@ -250,5 +251,5 @@ int __init s3c2412_init(void)
250#endif 251#endif
251 register_syscore_ops(&s3c24xx_irq_syscore_ops); 252 register_syscore_ops(&s3c24xx_irq_syscore_ops);
252 253
253 return sysdev_register(&s3c2412_sysdev); 254 return device_register(&s3c2412_dev);
254} 255}
diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c
index 28ad20d42445..36df761061de 100644
--- a/arch/arm/mach-s3c2416/irq.c
+++ b/arch/arm/mach-s3c2416/irq.c
@@ -25,7 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/ioport.h> 27#include <linux/ioport.h>
28#include <linux/sysdev.h> 28#include <linux/device.h>
29#include <linux/io.h> 29#include <linux/io.h>
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -213,7 +213,7 @@ static int __init s3c2416_add_sub(unsigned int base,
213 return 0; 213 return 0;
214} 214}
215 215
216static int __init s3c2416_irq_add(struct sys_device *sysdev) 216static int __init s3c2416_irq_add(struct device *dev)
217{ 217{
218 printk(KERN_INFO "S3C2416: IRQ Support\n"); 218 printk(KERN_INFO "S3C2416: IRQ Support\n");
219 219
@@ -234,13 +234,15 @@ static int __init s3c2416_irq_add(struct sys_device *sysdev)
234 return 0; 234 return 0;
235} 235}
236 236
237static struct sysdev_driver s3c2416_irq_driver = { 237static struct subsys_interface s3c2416_irq_interface = {
238 .add = s3c2416_irq_add, 238 .name = "s3c2416_irq",
239 .subsys = &s3c2416_subsys,
240 .add_dev = s3c2416_irq_add,
239}; 241};
240 242
241static int __init s3c2416_irq_init(void) 243static int __init s3c2416_irq_init(void)
242{ 244{
243 return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_irq_driver); 245 return subsys_interface_register(&s3c2416_irq_interface);
244} 246}
245 247
246arch_initcall(s3c2416_irq_init); 248arch_initcall(s3c2416_irq_init);
diff --git a/arch/arm/mach-s3c2416/pm.c b/arch/arm/mach-s3c2416/pm.c
index 9ec54f1d8e75..3bdb15a0d419 100644
--- a/arch/arm/mach-s3c2416/pm.c
+++ b/arch/arm/mach-s3c2416/pm.c
@@ -10,7 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13#include <linux/sysdev.h> 13#include <linux/device.h>
14#include <linux/syscore_ops.h> 14#include <linux/syscore_ops.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
@@ -48,7 +48,7 @@ static void s3c2416_pm_prepare(void)
48 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); 48 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1);
49} 49}
50 50
51static int s3c2416_pm_add(struct sys_device *sysdev) 51static int s3c2416_pm_add(struct device *dev)
52{ 52{
53 pm_cpu_prep = s3c2416_pm_prepare; 53 pm_cpu_prep = s3c2416_pm_prepare;
54 pm_cpu_sleep = s3c2416_cpu_suspend; 54 pm_cpu_sleep = s3c2416_cpu_suspend;
@@ -56,13 +56,15 @@ static int s3c2416_pm_add(struct sys_device *sysdev)
56 return 0; 56 return 0;
57} 57}
58 58
59static struct sysdev_driver s3c2416_pm_driver = { 59static struct subsys_interface s3c2416_pm_interface = {
60 .add = s3c2416_pm_add, 60 .name = "s3c2416_pm",
61 .subsys = &s3c2416_subsys,
62 .add_dev = s3c2416_pm_add,
61}; 63};
62 64
63static __init int s3c2416_pm_init(void) 65static __init int s3c2416_pm_init(void)
64{ 66{
65 return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver); 67 return subsys_interface_register(&s3c2416_pm_interface);
66} 68}
67 69
68arch_initcall(s3c2416_pm_init); 70arch_initcall(s3c2416_pm_init);
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index ee214bc83c83..143db908c2c5 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -31,7 +31,7 @@
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/serial_core.h> 33#include <linux/serial_core.h>
34#include <linux/sysdev.h> 34#include <linux/device.h>
35#include <linux/syscore_ops.h> 35#include <linux/syscore_ops.h>
36#include <linux/clk.h> 36#include <linux/clk.h>
37#include <linux/io.h> 37#include <linux/io.h>
@@ -68,12 +68,13 @@ static struct map_desc s3c2416_iodesc[] __initdata = {
68 IODESC_ENT(TIMER), 68 IODESC_ENT(TIMER),
69}; 69};
70 70
71struct sysdev_class s3c2416_sysclass = { 71struct bus_type s3c2416_subsys = {
72 .name = "s3c2416-core", 72 .name = "s3c2416-core",
73 .dev_name = "s3c2416-core",
73}; 74};
74 75
75static struct sys_device s3c2416_sysdev = { 76static struct device s3c2416_dev = {
76 .cls = &s3c2416_sysclass, 77 .bus = &s3c2416_subsys,
77}; 78};
78 79
79static void s3c2416_hard_reset(void) 80static void s3c2416_hard_reset(void)
@@ -105,7 +106,7 @@ int __init s3c2416_init(void)
105#endif 106#endif
106 register_syscore_ops(&s3c24xx_irq_syscore_ops); 107 register_syscore_ops(&s3c24xx_irq_syscore_ops);
107 108
108 return sysdev_register(&s3c2416_sysdev); 109 return device_register(&s3c2416_dev);
109} 110}
110 111
111void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no) 112void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)
@@ -133,7 +134,7 @@ void __init s3c2416_map_io(void)
133 iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc)); 134 iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
134} 135}
135 136
136/* need to register class before we actually register the device, and 137/* need to register the subsystem before we actually register the device, and
137 * we also need to ensure that it has been initialised before any of the 138 * we also need to ensure that it has been initialised before any of the
138 * drivers even try to use it (even if not on an s3c2416 based system) 139 * drivers even try to use it (even if not on an s3c2416 based system)
139 * as a driver which may support both 2443 and 2440 may try and use it. 140 * as a driver which may support both 2443 and 2440 may try and use it.
@@ -141,7 +142,7 @@ void __init s3c2416_map_io(void)
141 142
142static int __init s3c2416_core_init(void) 143static int __init s3c2416_core_init(void)
143{ 144{
144 return sysdev_class_register(&s3c2416_sysclass); 145 return subsys_system_register(&s3c2416_subsys, NULL);
145} 146}
146 147
147core_initcall(s3c2416_core_init); 148core_initcall(s3c2416_core_init);
diff --git a/arch/arm/mach-s3c2440/clock.c b/arch/arm/mach-s3c2440/clock.c
index f9e6bdaf41d2..d8957592fdc4 100644
--- a/arch/arm/mach-s3c2440/clock.c
+++ b/arch/arm/mach-s3c2440/clock.c
@@ -28,7 +28,6 @@
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/sysdev.h>
32#include <linux/interrupt.h> 31#include <linux/interrupt.h>
33#include <linux/ioport.h> 32#include <linux/ioport.h>
34#include <linux/mutex.h> 33#include <linux/mutex.h>
@@ -108,7 +107,7 @@ static struct clk s3c2440_clk_ac97 = {
108 .ctrlbit = S3C2440_CLKCON_CAMERA, 107 .ctrlbit = S3C2440_CLKCON_CAMERA,
109}; 108};
110 109
111static int s3c2440_clk_add(struct sys_device *sysdev) 110static int s3c2440_clk_add(struct device *dev)
112{ 111{
113 struct clk *clock_upll; 112 struct clk *clock_upll;
114 struct clk *clock_h; 113 struct clk *clock_h;
@@ -137,13 +136,15 @@ static int s3c2440_clk_add(struct sys_device *sysdev)
137 return 0; 136 return 0;
138} 137}
139 138
140static struct sysdev_driver s3c2440_clk_driver = { 139static struct subsys_interface s3c2440_clk_interface = {
141 .add = s3c2440_clk_add, 140 .name = "s3c2440_clk",
141 .subsys = &s3c2440_subsys,
142 .add_dev = s3c2440_clk_add,
142}; 143};
143 144
144static __init int s3c24xx_clk_driver(void) 145static __init int s3c24xx_clk_init(void)
145{ 146{
146 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver); 147 return subsys_interface_register(&s3c2440_clk_interface);
147} 148}
148 149
149arch_initcall(s3c24xx_clk_driver); 150arch_initcall(s3c24xx_clk_init);
diff --git a/arch/arm/mach-s3c2440/dma.c b/arch/arm/mach-s3c2440/dma.c
index 0e73f8f9d132..15b1ddf8f626 100644
--- a/arch/arm/mach-s3c2440/dma.c
+++ b/arch/arm/mach-s3c2440/dma.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19 19
20#include <mach/map.h> 20#include <mach/map.h>
@@ -174,20 +174,22 @@ static struct s3c24xx_dma_order __initdata s3c2440_dma_order = {
174 }, 174 },
175}; 175};
176 176
177static int __init s3c2440_dma_add(struct sys_device *sysdev) 177static int __init s3c2440_dma_add(struct device *dev)
178{ 178{
179 s3c2410_dma_init(); 179 s3c2410_dma_init();
180 s3c24xx_dma_order_set(&s3c2440_dma_order); 180 s3c24xx_dma_order_set(&s3c2440_dma_order);
181 return s3c24xx_dma_init_map(&s3c2440_dma_sel); 181 return s3c24xx_dma_init_map(&s3c2440_dma_sel);
182} 182}
183 183
184static struct sysdev_driver s3c2440_dma_driver = { 184static struct subsys_interface s3c2440_dma_interface = {
185 .add = s3c2440_dma_add, 185 .name = "s3c2440_dma",
186 .subsys = &s3c2440_subsys,
187 .add_dev = s3c2440_dma_add,
186}; 188};
187 189
188static int __init s3c2440_dma_init(void) 190static int __init s3c2440_dma_init(void)
189{ 191{
190 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_dma_driver); 192 return subsys_interface_register(&s3c2440_dma_interface);
191} 193}
192 194
193arch_initcall(s3c2440_dma_init); 195arch_initcall(s3c2440_dma_init);
diff --git a/arch/arm/mach-s3c2440/irq.c b/arch/arm/mach-s3c2440/irq.c
index eb1cc0f0705e..4fee9bc6bcb5 100644
--- a/arch/arm/mach-s3c2440/irq.c
+++ b/arch/arm/mach-s3c2440/irq.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/io.h> 27#include <linux/io.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
@@ -92,7 +92,7 @@ static struct irq_chip s3c_irq_wdtac97 = {
92 .irq_ack = s3c_irq_wdtac97_ack, 92 .irq_ack = s3c_irq_wdtac97_ack,
93}; 93};
94 94
95static int s3c2440_irq_add(struct sys_device *sysdev) 95static int s3c2440_irq_add(struct device *dev)
96{ 96{
97 unsigned int irqno; 97 unsigned int irqno;
98 98
@@ -113,13 +113,15 @@ static int s3c2440_irq_add(struct sys_device *sysdev)
113 return 0; 113 return 0;
114} 114}
115 115
116static struct sysdev_driver s3c2440_irq_driver = { 116static struct subsys_interface s3c2440_irq_interface = {
117 .add = s3c2440_irq_add, 117 .name = "s3c2440_irq",
118 .subsys = &s3c2440_subsys,
119 .add_dev = s3c2440_irq_add,
118}; 120};
119 121
120static int s3c2440_irq_init(void) 122static int s3c2440_irq_init(void)
121{ 123{
122 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver); 124 return subsys_interface_register(&s3c2440_irq_interface);
123} 125}
124 126
125arch_initcall(s3c2440_irq_init); 127arch_initcall(s3c2440_irq_init);
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index 0d3453bf567c..2078c1fe8e35 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -24,7 +24,7 @@
24#include <linux/serial_core.h> 24#include <linux/serial_core.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/gpio_keys.h> 26#include <linux/gpio_keys.h>
27#include <linux/sysdev.h> 27#include <linux/device.h>
28#include <linux/pda_power.h> 28#include <linux/pda_power.h>
29#include <linux/pwm_backlight.h> 29#include <linux/pwm_backlight.h>
30#include <linux/pwm.h> 30#include <linux/pwm.h>
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index e19499c2f909..4c2f553fbd52 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -20,7 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/tty.h> 21#include <linux/tty.h>
22#include <linux/console.h> 22#include <linux/console.h>
23#include <linux/sysdev.h> 23#include <linux/device.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/serial_core.h> 25#include <linux/serial_core.h>
26#include <linux/serial.h> 26#include <linux/serial.h>
diff --git a/arch/arm/mach-s3c2440/s3c2440-cpufreq.c b/arch/arm/mach-s3c2440/s3c2440-cpufreq.c
index 976002fb1b8f..cf7596694efe 100644
--- a/arch/arm/mach-s3c2440/s3c2440-cpufreq.c
+++ b/arch/arm/mach-s3c2440/s3c2440-cpufreq.c
@@ -17,7 +17,7 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/cpufreq.h> 19#include <linux/cpufreq.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/err.h> 23#include <linux/err.h>
@@ -270,7 +270,7 @@ struct s3c_cpufreq_info s3c2440_cpufreq_info = {
270 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs), 270 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs),
271}; 271};
272 272
273static int s3c2440_cpufreq_add(struct sys_device *sysdev) 273static int s3c2440_cpufreq_add(struct device *dev)
274{ 274{
275 xtal = s3c_cpufreq_clk_get(NULL, "xtal"); 275 xtal = s3c_cpufreq_clk_get(NULL, "xtal");
276 hclk = s3c_cpufreq_clk_get(NULL, "hclk"); 276 hclk = s3c_cpufreq_clk_get(NULL, "hclk");
@@ -285,27 +285,29 @@ static int s3c2440_cpufreq_add(struct sys_device *sysdev)
285 return s3c_cpufreq_register(&s3c2440_cpufreq_info); 285 return s3c_cpufreq_register(&s3c2440_cpufreq_info);
286} 286}
287 287
288static struct sysdev_driver s3c2440_cpufreq_driver = { 288static struct subsys_interface s3c2440_cpufreq_interface = {
289 .add = s3c2440_cpufreq_add, 289 .name = "s3c2440_cpufreq",
290 .subsys = &s3c2440_subsys,
291 .add_dev = s3c2440_cpufreq_add,
290}; 292};
291 293
292static int s3c2440_cpufreq_init(void) 294static int s3c2440_cpufreq_init(void)
293{ 295{
294 return sysdev_driver_register(&s3c2440_sysclass, 296 return subsys_interface_register(&s3c2440_cpufreq_interface);
295 &s3c2440_cpufreq_driver);
296} 297}
297 298
298/* arch_initcall adds the clocks we need, so use subsys_initcall. */ 299/* arch_initcall adds the clocks we need, so use subsys_initcall. */
299subsys_initcall(s3c2440_cpufreq_init); 300subsys_initcall(s3c2440_cpufreq_init);
300 301
301static struct sysdev_driver s3c2442_cpufreq_driver = { 302static struct subsys_interface s3c2442_cpufreq_interface = {
302 .add = s3c2440_cpufreq_add, 303 .name = "s3c2442_cpufreq",
304 .subsys = &s3c2442_subsys,
305 .add_dev = s3c2440_cpufreq_add,
303}; 306};
304 307
305static int s3c2442_cpufreq_init(void) 308static int s3c2442_cpufreq_init(void)
306{ 309{
307 return sysdev_driver_register(&s3c2442_sysclass, 310 return subsys_interface_register(&s3c2442_cpufreq_interface);
308 &s3c2442_cpufreq_driver);
309} 311}
310 312
311subsys_initcall(s3c2442_cpufreq_init); 313subsys_initcall(s3c2442_cpufreq_init);
diff --git a/arch/arm/mach-s3c2440/s3c2440-pll-12000000.c b/arch/arm/mach-s3c2440/s3c2440-pll-12000000.c
index f105d5e8c477..b5368ae8d7fe 100644
--- a/arch/arm/mach-s3c2440/s3c2440-pll-12000000.c
+++ b/arch/arm/mach-s3c2440/s3c2440-pll-12000000.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/err.h> 19#include <linux/err.h>
20 20
@@ -51,7 +51,7 @@ static struct cpufreq_frequency_table s3c2440_plls_12[] __initdata = {
51 { .frequency = 400000000, .index = PLLVAL(0x5c, 1, 1), }, /* FVco 800.000000 */ 51 { .frequency = 400000000, .index = PLLVAL(0x5c, 1, 1), }, /* FVco 800.000000 */
52}; 52};
53 53
54static int s3c2440_plls12_add(struct sys_device *dev) 54static int s3c2440_plls12_add(struct device *dev)
55{ 55{
56 struct clk *xtal_clk; 56 struct clk *xtal_clk;
57 unsigned long xtal; 57 unsigned long xtal;
@@ -72,25 +72,29 @@ static int s3c2440_plls12_add(struct sys_device *dev)
72 return 0; 72 return 0;
73} 73}
74 74
75static struct sysdev_driver s3c2440_plls12_drv = { 75static struct subsys_interface s3c2440_plls12_interface = {
76 .add = s3c2440_plls12_add, 76 .name = "s3c2440_plls12",
77 .subsys = &s3c2440_subsys,
78 .add_dev = s3c2440_plls12_add,
77}; 79};
78 80
79static int __init s3c2440_pll_12mhz(void) 81static int __init s3c2440_pll_12mhz(void)
80{ 82{
81 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_plls12_drv); 83 return subsys_interface_register(&s3c2440_plls12_interface);
82 84
83} 85}
84 86
85arch_initcall(s3c2440_pll_12mhz); 87arch_initcall(s3c2440_pll_12mhz);
86 88
87static struct sysdev_driver s3c2442_plls12_drv = { 89static struct subsys_interface s3c2442_plls12_interface = {
88 .add = s3c2440_plls12_add, 90 .name = "s3c2442_plls12",
91 .subsys = &s3c2442_subsys,
92 .add_dev = s3c2440_plls12_add,
89}; 93};
90 94
91static int __init s3c2442_pll_12mhz(void) 95static int __init s3c2442_pll_12mhz(void)
92{ 96{
93 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_plls12_drv); 97 return subsys_interface_register(&s3c2442_plls12_interface);
94 98
95} 99}
96 100
diff --git a/arch/arm/mach-s3c2440/s3c2440-pll-16934400.c b/arch/arm/mach-s3c2440/s3c2440-pll-16934400.c
index c8a8f90ef382..42f2b5cd2399 100644
--- a/arch/arm/mach-s3c2440/s3c2440-pll-16934400.c
+++ b/arch/arm/mach-s3c2440/s3c2440-pll-16934400.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/err.h> 19#include <linux/err.h>
20 20
@@ -79,7 +79,7 @@ static struct cpufreq_frequency_table s3c2440_plls_169344[] __initdata = {
79 { .frequency = 402192000, .index = PLLVAL(87, 2, 1), }, /* FVco 804.384000 */ 79 { .frequency = 402192000, .index = PLLVAL(87, 2, 1), }, /* FVco 804.384000 */
80}; 80};
81 81
82static int s3c2440_plls169344_add(struct sys_device *dev) 82static int s3c2440_plls169344_add(struct device *dev)
83{ 83{
84 struct clk *xtal_clk; 84 struct clk *xtal_clk;
85 unsigned long xtal; 85 unsigned long xtal;
@@ -100,28 +100,28 @@ static int s3c2440_plls169344_add(struct sys_device *dev)
100 return 0; 100 return 0;
101} 101}
102 102
103static struct sysdev_driver s3c2440_plls169344_drv = { 103static struct subsys_interface s3c2440_plls169344_interface = {
104 .add = s3c2440_plls169344_add, 104 .name = "s3c2440_plls169344",
105 .subsys = &s3c2440_subsys,
106 .add_dev = s3c2440_plls169344_add,
105}; 107};
106 108
107static int __init s3c2440_pll_16934400(void) 109static int __init s3c2440_pll_16934400(void)
108{ 110{
109 return sysdev_driver_register(&s3c2440_sysclass, 111 return subsys_interface_register(&s3c2440_plls169344_interface);
110 &s3c2440_plls169344_drv);
111
112} 112}
113 113
114arch_initcall(s3c2440_pll_16934400); 114arch_initcall(s3c2440_pll_16934400);
115 115
116static struct sysdev_driver s3c2442_plls169344_drv = { 116static struct subsys_interface s3c2442_plls169344_interface = {
117 .add = s3c2440_plls169344_add, 117 .name = "s3c2442_plls169344",
118 .subsys = &s3c2442_subsys,
119 .add_dev = s3c2440_plls169344_add,
118}; 120};
119 121
120static int __init s3c2442_pll_16934400(void) 122static int __init s3c2442_pll_16934400(void)
121{ 123{
122 return sysdev_driver_register(&s3c2442_sysclass, 124 return subsys_interface_register(&s3c2442_plls169344_interface);
123 &s3c2442_plls169344_drv);
124
125} 125}
126 126
127arch_initcall(s3c2442_pll_16934400); 127arch_initcall(s3c2442_pll_16934400);
diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c2440/s3c2440.c
index 37f8cc6aabd4..2b3dddb49af7 100644
--- a/arch/arm/mach-s3c2440/s3c2440.c
+++ b/arch/arm/mach-s3c2440/s3c2440.c
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/sysdev.h> 21#include <linux/device.h>
22#include <linux/syscore_ops.h> 22#include <linux/syscore_ops.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/clk.h> 24#include <linux/clk.h>
@@ -40,8 +40,8 @@
40#include <plat/gpio-cfg.h> 40#include <plat/gpio-cfg.h>
41#include <plat/gpio-cfg-helpers.h> 41#include <plat/gpio-cfg-helpers.h>
42 42
43static struct sys_device s3c2440_sysdev = { 43static struct device s3c2440_dev = {
44 .cls = &s3c2440_sysclass, 44 .bus = &s3c2440_subsys,
45}; 45};
46 46
47int __init s3c2440_init(void) 47int __init s3c2440_init(void)
@@ -63,7 +63,7 @@ int __init s3c2440_init(void)
63 63
64 /* register our system device for everything else */ 64 /* register our system device for everything else */
65 65
66 return sysdev_register(&s3c2440_sysdev); 66 return device_register(&s3c2440_dev);
67} 67}
68 68
69void __init s3c2440_map_io(void) 69void __init s3c2440_map_io(void)
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c
index 2c822e09392f..8004e0497bf4 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c2440/s3c2442.c
@@ -28,7 +28,6 @@
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/sysdev.h>
32#include <linux/syscore_ops.h> 31#include <linux/syscore_ops.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
34#include <linux/ioport.h> 33#include <linux/ioport.h>
@@ -123,7 +122,7 @@ static struct clk s3c2442_clk_cam_upll = {
123 }, 122 },
124}; 123};
125 124
126static int s3c2442_clk_add(struct sys_device *sysdev) 125static int s3c2442_clk_add(struct device *dev)
127{ 126{
128 struct clk *clock_upll; 127 struct clk *clock_upll;
129 struct clk *clock_h; 128 struct clk *clock_h;
@@ -149,20 +148,22 @@ static int s3c2442_clk_add(struct sys_device *sysdev)
149 return 0; 148 return 0;
150} 149}
151 150
152static struct sysdev_driver s3c2442_clk_driver = { 151static struct subsys_interface s3c2442_clk_interface = {
153 .add = s3c2442_clk_add, 152 .name = "s3c2442_clk",
153 .subsys = &s3c2442_subsys,
154 .add_dev = s3c2442_clk_add,
154}; 155};
155 156
156static __init int s3c2442_clk_init(void) 157static __init int s3c2442_clk_init(void)
157{ 158{
158 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_clk_driver); 159 return subsys_interface_register(&s3c2442_clk_interface);
159} 160}
160 161
161arch_initcall(s3c2442_clk_init); 162arch_initcall(s3c2442_clk_init);
162 163
163 164
164static struct sys_device s3c2442_sysdev = { 165static struct device s3c2442_dev = {
165 .cls = &s3c2442_sysclass, 166 .bus = &s3c2442_subsys,
166}; 167};
167 168
168int __init s3c2442_init(void) 169int __init s3c2442_init(void)
@@ -175,7 +176,7 @@ int __init s3c2442_init(void)
175 register_syscore_ops(&s3c244x_pm_syscore_ops); 176 register_syscore_ops(&s3c244x_pm_syscore_ops);
176 register_syscore_ops(&s3c24xx_irq_syscore_ops); 177 register_syscore_ops(&s3c24xx_irq_syscore_ops);
177 178
178 return sysdev_register(&s3c2442_sysdev); 179 return device_register(&s3c2442_dev);
179} 180}
180 181
181void __init s3c2442_map_io(void) 182void __init s3c2442_map_io(void)
diff --git a/arch/arm/mach-s3c2440/s3c244x-clock.c b/arch/arm/mach-s3c2440/s3c244x-clock.c
index 7f5ea0a169a5..b3fdbdda3d5f 100644
--- a/arch/arm/mach-s3c2440/s3c244x-clock.c
+++ b/arch/arm/mach-s3c2440/s3c244x-clock.c
@@ -28,7 +28,6 @@
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/sysdev.h>
32#include <linux/interrupt.h> 31#include <linux/interrupt.h>
33#include <linux/ioport.h> 32#include <linux/ioport.h>
34#include <linux/clk.h> 33#include <linux/clk.h>
@@ -73,7 +72,7 @@ static struct clk clk_arm = {
73 }, 72 },
74}; 73};
75 74
76static int s3c244x_clk_add(struct sys_device *sysdev) 75static int s3c244x_clk_add(struct device *dev)
77{ 76{
78 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); 77 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
79 unsigned long clkdivn; 78 unsigned long clkdivn;
@@ -115,24 +114,28 @@ static int s3c244x_clk_add(struct sys_device *sysdev)
115 return 0; 114 return 0;
116} 115}
117 116
118static struct sysdev_driver s3c2440_clk_driver = { 117static struct subsys_interface s3c2440_clk_interface = {
119 .add = s3c244x_clk_add, 118 .name = "s3c2440_clk",
119 .subsys = &s3c2440_subsys,
120 .add_dev = s3c244x_clk_add,
120}; 121};
121 122
122static int s3c2440_clk_init(void) 123static int s3c2440_clk_init(void)
123{ 124{
124 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver); 125 return subsys_interface_register(&s3c2440_clk_interface);
125} 126}
126 127
127arch_initcall(s3c2440_clk_init); 128arch_initcall(s3c2440_clk_init);
128 129
129static struct sysdev_driver s3c2442_clk_driver = { 130static struct subsys_interface s3c2442_clk_interface = {
130 .add = s3c244x_clk_add, 131 .name = "s3c2442_clk",
132 .subsys = &s3c2442_subsys,
133 .add_dev = s3c244x_clk_add,
131}; 134};
132 135
133static int s3c2442_clk_init(void) 136static int s3c2442_clk_init(void)
134{ 137{
135 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_clk_driver); 138 return subsys_interface_register(&s3c2442_clk_interface);
136} 139}
137 140
138arch_initcall(s3c2442_clk_init); 141arch_initcall(s3c2442_clk_init);
diff --git a/arch/arm/mach-s3c2440/s3c244x-irq.c b/arch/arm/mach-s3c2440/s3c244x-irq.c
index c63e8f26d901..74d3dcf46a48 100644
--- a/arch/arm/mach-s3c2440/s3c244x-irq.c
+++ b/arch/arm/mach-s3c2440/s3c244x-irq.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/io.h> 27#include <linux/io.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
@@ -91,7 +91,7 @@ static struct irq_chip s3c_irq_cam = {
91 .irq_ack = s3c_irq_cam_ack, 91 .irq_ack = s3c_irq_cam_ack,
92}; 92};
93 93
94static int s3c244x_irq_add(struct sys_device *sysdev) 94static int s3c244x_irq_add(struct device *dev)
95{ 95{
96 unsigned int irqno; 96 unsigned int irqno;
97 97
@@ -114,25 +114,29 @@ static int s3c244x_irq_add(struct sys_device *sysdev)
114 return 0; 114 return 0;
115} 115}
116 116
117static struct sysdev_driver s3c2440_irq_driver = { 117static struct subsys_interface s3c2440_irq_interface = {
118 .add = s3c244x_irq_add, 118 .name = "s3c2440_irq",
119 .subsys = &s3c2440_subsys,
120 .add_dev = s3c244x_irq_add,
119}; 121};
120 122
121static int s3c2440_irq_init(void) 123static int s3c2440_irq_init(void)
122{ 124{
123 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver); 125 return subsys_interface_register(&s3c2440_irq_interface);
124} 126}
125 127
126arch_initcall(s3c2440_irq_init); 128arch_initcall(s3c2440_irq_init);
127 129
128static struct sysdev_driver s3c2442_irq_driver = { 130static struct subsys_interface s3c2442_irq_interface = {
129 .add = s3c244x_irq_add, 131 .name = "s3c2442_irq",
132 .subsys = &s3c2442_subsys,
133 .add_dev = s3c244x_irq_add,
130}; 134};
131 135
132 136
133static int s3c2442_irq_init(void) 137static int s3c2442_irq_init(void)
134{ 138{
135 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_irq_driver); 139 return subsys_interface_register(&s3c2442_irq_interface);
136} 140}
137 141
138arch_initcall(s3c2442_irq_init); 142arch_initcall(s3c2442_irq_init);
diff --git a/arch/arm/mach-s3c2440/s3c244x.c b/arch/arm/mach-s3c2440/s3c244x.c
index 7e8a23d2098a..36bc60f61d0a 100644
--- a/arch/arm/mach-s3c2440/s3c244x.c
+++ b/arch/arm/mach-s3c2440/s3c244x.c
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/serial_core.h> 19#include <linux/serial_core.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/sysdev.h> 21#include <linux/device.h>
22#include <linux/syscore_ops.h> 22#include <linux/syscore_ops.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
@@ -135,17 +135,19 @@ void __init s3c244x_init_clocks(int xtal)
135 s3c2410_baseclk_add(); 135 s3c2410_baseclk_add();
136} 136}
137 137
138/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */ 138/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
139 139
140struct sysdev_class s3c2440_sysclass = { 140struct bus_type s3c2440_subsys = {
141 .name = "s3c2440-core", 141 .name = "s3c2440-core",
142 .dev_name = "s3c2440-core",
142}; 143};
143 144
144struct sysdev_class s3c2442_sysclass = { 145struct bus_type s3c2442_subsys = {
145 .name = "s3c2442-core", 146 .name = "s3c2442-core",
147 .dev_name = "s3c2442-core",
146}; 148};
147 149
148/* need to register class before we actually register the device, and 150/* need to register the subsystem before we actually register the device, and
149 * we also need to ensure that it has been initialised before any of the 151 * we also need to ensure that it has been initialised before any of the
150 * drivers even try to use it (even if not on an s3c2440 based system) 152 * drivers even try to use it (even if not on an s3c2440 based system)
151 * as a driver which may support both 2410 and 2440 may try and use it. 153 * as a driver which may support both 2410 and 2440 may try and use it.
@@ -153,14 +155,14 @@ struct sysdev_class s3c2442_sysclass = {
153 155
154static int __init s3c2440_core_init(void) 156static int __init s3c2440_core_init(void)
155{ 157{
156 return sysdev_class_register(&s3c2440_sysclass); 158 return subsys_system_register(&s3c2440_subsys, NULL);
157} 159}
158 160
159core_initcall(s3c2440_core_init); 161core_initcall(s3c2440_core_init);
160 162
161static int __init s3c2442_core_init(void) 163static int __init s3c2442_core_init(void)
162{ 164{
163 return sysdev_class_register(&s3c2442_sysclass); 165 return subsys_system_register(&s3c2442_subsys, NULL);
164} 166}
165 167
166core_initcall(s3c2442_core_init); 168core_initcall(s3c2442_core_init);
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index 1c2c088aa2e8..6dde2696f8f0 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -27,7 +27,7 @@
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/sysdev.h> 30#include <linux/device.h>
31#include <linux/clk.h> 31#include <linux/clk.h>
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/serial_core.h> 33#include <linux/serial_core.h>
diff --git a/arch/arm/mach-s3c2443/dma.c b/arch/arm/mach-s3c2443/dma.c
index fe52151d2e84..de6b4a23c9ed 100644
--- a/arch/arm/mach-s3c2443/dma.c
+++ b/arch/arm/mach-s3c2443/dma.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
@@ -135,19 +135,21 @@ static struct s3c24xx_dma_selection __initdata s3c2443_dma_sel = {
135 .map_size = ARRAY_SIZE(s3c2443_dma_mappings), 135 .map_size = ARRAY_SIZE(s3c2443_dma_mappings),
136}; 136};
137 137
138static int __init s3c2443_dma_add(struct sys_device *sysdev) 138static int __init s3c2443_dma_add(struct device *dev)
139{ 139{
140 s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100); 140 s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100);
141 return s3c24xx_dma_init_map(&s3c2443_dma_sel); 141 return s3c24xx_dma_init_map(&s3c2443_dma_sel);
142} 142}
143 143
144static struct sysdev_driver s3c2443_dma_driver = { 144static struct subsys_interface s3c2443_dma_interface = {
145 .add = s3c2443_dma_add, 145 .name = "s3c2443_dma",
146 .subsys = &s3c2443_subsys,
147 .add_dev = s3c2443_dma_add,
146}; 148};
147 149
148static int __init s3c2443_dma_init(void) 150static int __init s3c2443_dma_init(void)
149{ 151{
150 return sysdev_driver_register(&s3c2443_sysclass, &s3c2443_dma_driver); 152 return subsys_interface_register(&s3c2443_dma_interface);
151} 153}
152 154
153arch_initcall(s3c2443_dma_init); 155arch_initcall(s3c2443_dma_init);
diff --git a/arch/arm/mach-s3c2443/irq.c b/arch/arm/mach-s3c2443/irq.c
index 83ecb1173fb1..35e4ff24fb43 100644
--- a/arch/arm/mach-s3c2443/irq.c
+++ b/arch/arm/mach-s3c2443/irq.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/io.h> 27#include <linux/io.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
@@ -241,7 +241,7 @@ static int __init s3c2443_add_sub(unsigned int base,
241 return 0; 241 return 0;
242} 242}
243 243
244static int __init s3c2443_irq_add(struct sys_device *sysdev) 244static int __init s3c2443_irq_add(struct device *dev)
245{ 245{
246 printk("S3C2443: IRQ Support\n"); 246 printk("S3C2443: IRQ Support\n");
247 247
@@ -265,13 +265,15 @@ static int __init s3c2443_irq_add(struct sys_device *sysdev)
265 return 0; 265 return 0;
266} 266}
267 267
268static struct sysdev_driver s3c2443_irq_driver = { 268static struct subsys_interface s3c2443_irq_interface = {
269 .add = s3c2443_irq_add, 269 .name = "s3c2443_irq",
270 .subsys = &s3c2443_subsys,
271 .add_dev = s3c2443_irq_add,
270}; 272};
271 273
272static int __init s3c2443_irq_init(void) 274static int __init s3c2443_irq_init(void)
273{ 275{
274 return sysdev_driver_register(&s3c2443_sysclass, &s3c2443_irq_driver); 276 return subsys_interface_register(&s3c2443_irq_interface);
275} 277}
276 278
277arch_initcall(s3c2443_irq_init); 279arch_initcall(s3c2443_irq_init);
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index a22b771b0f36..aa90ae4fc980 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -19,7 +19,7 @@
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/sysdev.h> 22#include <linux/device.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
@@ -49,12 +49,13 @@ static struct map_desc s3c2443_iodesc[] __initdata = {
49 IODESC_ENT(TIMER), 49 IODESC_ENT(TIMER),
50}; 50};
51 51
52struct sysdev_class s3c2443_sysclass = { 52struct bus_type s3c2443_subsys = {
53 .name = "s3c2443-core", 53 .name = "s3c2443-core",
54 .dev_name = "s3c2443-core",
54}; 55};
55 56
56static struct sys_device s3c2443_sysdev = { 57static struct device s3c2443_dev = {
57 .cls = &s3c2443_sysclass, 58 .bus = &s3c2443_subsys,
58}; 59};
59 60
60static void s3c2443_hard_reset(void) 61static void s3c2443_hard_reset(void)
@@ -77,7 +78,7 @@ int __init s3c2443_init(void)
77 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; 78 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
78 s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; 79 s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT;
79 80
80 return sysdev_register(&s3c2443_sysdev); 81 return device_register(&s3c2443_dev);
81} 82}
82 83
83void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no) 84void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
@@ -99,7 +100,7 @@ void __init s3c2443_map_io(void)
99 iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); 100 iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
100} 101}
101 102
102/* need to register class before we actually register the device, and 103/* need to register the subsystem before we actually register the device, and
103 * we also need to ensure that it has been initialised before any of the 104 * we also need to ensure that it has been initialised before any of the
104 * drivers even try to use it (even if not on an s3c2443 based system) 105 * drivers even try to use it (even if not on an s3c2443 based system)
105 * as a driver which may support both 2443 and 2440 may try and use it. 106 * as a driver which may support both 2443 and 2440 may try and use it.
@@ -107,7 +108,7 @@ void __init s3c2443_map_io(void)
107 108
108static int __init s3c2443_core_init(void) 109static int __init s3c2443_core_init(void)
109{ 110{
110 return sysdev_class_register(&s3c2443_sysclass); 111 return subsys_system_register(&s3c2443_subsys, NULL);
111} 112}
112 113
113core_initcall(s3c2443_core_init); 114core_initcall(s3c2443_core_init);
diff --git a/arch/arm/mach-s3c64xx/cpu.c b/arch/arm/mach-s3c64xx/cpu.c
index de085b798aa4..0f8a669dc7fc 100644
--- a/arch/arm/mach-s3c64xx/cpu.c
+++ b/arch/arm/mach-s3c64xx/cpu.c
@@ -16,7 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/sysdev.h> 19#include <linux/device.h>
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/io.h> 22#include <linux/io.h>
@@ -122,12 +122,13 @@ static struct map_desc s3c_iodesc[] __initdata = {
122}; 122};
123 123
124 124
125struct sysdev_class s3c64xx_sysclass = { 125struct bus_type s3c64xx_subsys = {
126 .name = "s3c64xx-core", 126 .name = "s3c64xx-core",
127 .dev_name = "s3c64xx-core",
127}; 128};
128 129
129static struct sys_device s3c64xx_sysdev = { 130static struct device s3c64xx_dev = {
130 .cls = &s3c64xx_sysclass, 131 .bus = &s3c64xx_subsys,
131}; 132};
132 133
133/* uart registration process */ 134/* uart registration process */
@@ -152,10 +153,10 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
152 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); 153 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
153} 154}
154 155
155static __init int s3c64xx_sysdev_init(void) 156static __init int s3c64xx_dev_init(void)
156{ 157{
157 sysdev_class_register(&s3c64xx_sysclass); 158 subsys_system_register(&s3c64xx_subsys, NULL);
158 return sysdev_register(&s3c64xx_sysdev); 159 return device_register(&s3c64xx_dev);
159} 160}
160 161
161core_initcall(s3c64xx_sysdev_init); 162core_initcall(s3c64xx_dev_init);
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index 17d62f4f8204..f2a7a1725596 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -16,7 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/dmapool.h> 18#include <linux/dmapool.h>
19#include <linux/sysdev.h> 19#include <linux/device.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
@@ -35,7 +35,7 @@
35/* dma channel state information */ 35/* dma channel state information */
36 36
37struct s3c64xx_dmac { 37struct s3c64xx_dmac {
38 struct sys_device sysdev; 38 struct device dev;
39 struct clk *clk; 39 struct clk *clk;
40 void __iomem *regs; 40 void __iomem *regs;
41 struct s3c2410_dma_chan *channels; 41 struct s3c2410_dma_chan *channels;
@@ -631,8 +631,9 @@ static irqreturn_t s3c64xx_dma_irq(int irq, void *pw)
631 return IRQ_HANDLED; 631 return IRQ_HANDLED;
632} 632}
633 633
634static struct sysdev_class dma_sysclass = { 634static struct bus_type dma_subsys = {
635 .name = "s3c64xx-dma", 635 .name = "s3c64xx-dma",
636 .dev_name = "s3c64xx-dma",
636}; 637};
637 638
638static int s3c64xx_dma_init1(int chno, enum dma_ch chbase, 639static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
@@ -651,12 +652,12 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
651 return -ENOMEM; 652 return -ENOMEM;
652 } 653 }
653 654
654 dmac->sysdev.id = chno / 8; 655 dmac->dev.id = chno / 8;
655 dmac->sysdev.cls = &dma_sysclass; 656 dmac->dev.bus = &dma_subsys;
656 657
657 err = sysdev_register(&dmac->sysdev); 658 err = device_register(&dmac->dev);
658 if (err) { 659 if (err) {
659 printk(KERN_ERR "%s: failed to register sysdevice\n", __func__); 660 printk(KERN_ERR "%s: failed to register device\n", __func__);
660 goto err_alloc; 661 goto err_alloc;
661 } 662 }
662 663
@@ -667,7 +668,7 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
667 goto err_dev; 668 goto err_dev;
668 } 669 }
669 670
670 snprintf(clkname, sizeof(clkname), "dma%d", dmac->sysdev.id); 671 snprintf(clkname, sizeof(clkname), "dma%d", dmac->dev.id);
671 672
672 dmac->clk = clk_get(NULL, clkname); 673 dmac->clk = clk_get(NULL, clkname);
673 if (IS_ERR(dmac->clk)) { 674 if (IS_ERR(dmac->clk)) {
@@ -715,7 +716,7 @@ err_clk:
715err_map: 716err_map:
716 iounmap(regs); 717 iounmap(regs);
717err_dev: 718err_dev:
718 sysdev_unregister(&dmac->sysdev); 719 device_unregister(&dmac->dev);
719err_alloc: 720err_alloc:
720 kfree(dmac); 721 kfree(dmac);
721 return err; 722 return err;
@@ -733,9 +734,9 @@ static int __init s3c64xx_dma_init(void)
733 return -ENOMEM; 734 return -ENOMEM;
734 } 735 }
735 736
736 ret = sysdev_class_register(&dma_sysclass); 737 ret = subsys_system_register(&dma_subsys, NULL);
737 if (ret) { 738 if (ret) {
738 printk(KERN_ERR "%s: failed to create sysclass\n", __func__); 739 printk(KERN_ERR "%s: failed to create subsys\n", __func__);
739 return -ENOMEM; 740 return -ENOMEM;
740 } 741 }
741 742
diff --git a/arch/arm/mach-s3c64xx/irq-eint.c b/arch/arm/mach-s3c64xx/irq-eint.c
index 4d203be1f4c3..e3e75d186039 100644
--- a/arch/arm/mach-s3c64xx/irq-eint.c
+++ b/arch/arm/mach-s3c64xx/irq-eint.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/io.h> 20#include <linux/io.h>
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c
index 51c00f2453c6..691a7ca78c1e 100644
--- a/arch/arm/mach-s3c64xx/s3c6400.c
+++ b/arch/arm/mach-s3c64xx/s3c6400.c
@@ -17,7 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23 23
@@ -70,17 +70,18 @@ void __init s3c6400_init_irq(void)
70 s3c64xx_init_irq(~0 & ~(0xf << 5), ~0); 70 s3c64xx_init_irq(~0 & ~(0xf << 5), ~0);
71} 71}
72 72
73static struct sysdev_class s3c6400_sysclass = { 73static struct bus_type s3c6400_subsys = {
74 .name = "s3c6400-core", 74 .name = "s3c6400-core",
75 .dev_name = "s3c6400-core",
75}; 76};
76 77
77static struct sys_device s3c6400_sysdev = { 78static struct device s3c6400_dev = {
78 .cls = &s3c6400_sysclass, 79 .bus = &s3c6400_subsys,
79}; 80};
80 81
81static int __init s3c6400_core_init(void) 82static int __init s3c6400_core_init(void)
82{ 83{
83 return sysdev_class_register(&s3c6400_sysclass); 84 return subsys_system_register(&s3c6400_subsys, NULL);
84} 85}
85 86
86core_initcall(s3c6400_core_init); 87core_initcall(s3c6400_core_init);
@@ -89,5 +90,5 @@ int __init s3c6400_init(void)
89{ 90{
90 printk("S3C6400: Initialising architecture\n"); 91 printk("S3C6400: Initialising architecture\n");
91 92
92 return sysdev_register(&s3c6400_sysdev); 93 return device_register(&s3c6400_dev);
93} 94}
diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c
index 4117003464ad..9a5484ad4308 100644
--- a/arch/arm/mach-s3c64xx/s3c6410.c
+++ b/arch/arm/mach-s3c64xx/s3c6410.c
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/sysdev.h> 21#include <linux/device.h>
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
@@ -75,17 +75,18 @@ void __init s3c6410_init_irq(void)
75 s3c64xx_init_irq(~0 & ~(1 << 7), ~0); 75 s3c64xx_init_irq(~0 & ~(1 << 7), ~0);
76} 76}
77 77
78struct sysdev_class s3c6410_sysclass = { 78struct bus_type s3c6410_subsys = {
79 .name = "s3c6410-core", 79 .name = "s3c6410-core",
80 .dev_name = "s3c6410-core",
80}; 81};
81 82
82static struct sys_device s3c6410_sysdev = { 83static struct device s3c6410_dev = {
83 .cls = &s3c6410_sysclass, 84 .bus = &s3c6410_subsys,
84}; 85};
85 86
86static int __init s3c6410_core_init(void) 87static int __init s3c6410_core_init(void)
87{ 88{
88 return sysdev_class_register(&s3c6410_sysclass); 89 return subsys_system_register(&s3c6410_subsys, NULL);
89} 90}
90 91
91core_initcall(s3c6410_core_init); 92core_initcall(s3c6410_core_init);
@@ -94,5 +95,5 @@ int __init s3c6410_init(void)
94{ 95{
95 printk("S3C6410: Initialising architecture\n"); 96 printk("S3C6410: Initialising architecture\n");
96 97
97 return sysdev_register(&s3c6410_sysdev); 98 return device_register(&s3c6410_dev);
98} 99}
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
index c54c65d511f0..8a293c3e3944 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
@@ -17,7 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include <mach/hardware.h> 23#include <mach/hardware.h>
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
index 2d04abfba12e..0277b483b9b7 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
@@ -17,7 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include <mach/hardware.h> 23#include <mach/hardware.h>
diff --git a/arch/arm/mach-s5p64x0/clock.c b/arch/arm/mach-s5p64x0/clock.c
index b52c6e2f37a6..041f91e5b425 100644
--- a/arch/arm/mach-s5p64x0/clock.c
+++ b/arch/arm/mach-s5p64x0/clock.c
@@ -17,7 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include <mach/hardware.h> 23#include <mach/hardware.h>
diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c
index ecab40cf19ab..74387a1bc76a 100644
--- a/arch/arm/mach-s5p64x0/cpu.c
+++ b/arch/arm/mach-s5p64x0/cpu.c
@@ -16,7 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/sysdev.h> 19#include <linux/device.h>
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
@@ -190,17 +190,18 @@ void __init s5p6450_init_irq(void)
190 s5p_init_irq(vic, ARRAY_SIZE(vic)); 190 s5p_init_irq(vic, ARRAY_SIZE(vic));
191} 191}
192 192
193struct sysdev_class s5p64x0_sysclass = { 193struct bus_type s5p64x0_subsys = {
194 .name = "s5p64x0-core", 194 .name = "s5p64x0-core",
195 .dev_name = "s5p64x0-core",
195}; 196};
196 197
197static struct sys_device s5p64x0_sysdev = { 198static struct device s5p64x0_dev = {
198 .cls = &s5p64x0_sysclass, 199 .bus = &s5p64x0_subsys,
199}; 200};
200 201
201static int __init s5p64x0_core_init(void) 202static int __init s5p64x0_core_init(void)
202{ 203{
203 return sysdev_class_register(&s5p64x0_sysclass); 204 return subsys_system_register(&s5p64x0_subsys, NULL);
204} 205}
205core_initcall(s5p64x0_core_init); 206core_initcall(s5p64x0_core_init);
206 207
@@ -211,5 +212,5 @@ int __init s5p64x0_init(void)
211 /* set idle function */ 212 /* set idle function */
212 pm_idle = s5p64x0_idle; 213 pm_idle = s5p64x0_idle;
213 214
214 return sysdev_register(&s5p64x0_sysdev); 215 return device_register(&s5p64x0_dev);
215} 216}
diff --git a/arch/arm/mach-s5p64x0/pm.c b/arch/arm/mach-s5p64x0/pm.c
index 69927243d25f..23f9b22439c9 100644
--- a/arch/arm/mach-s5p64x0/pm.c
+++ b/arch/arm/mach-s5p64x0/pm.c
@@ -160,7 +160,7 @@ static void s5p64x0_pm_prepare(void)
160 160
161} 161}
162 162
163static int s5p64x0_pm_add(struct sys_device *sysdev) 163static int s5p64x0_pm_add(struct device *dev)
164{ 164{
165 pm_cpu_prep = s5p64x0_pm_prepare; 165 pm_cpu_prep = s5p64x0_pm_prepare;
166 pm_cpu_sleep = s5p64x0_cpu_suspend; 166 pm_cpu_sleep = s5p64x0_cpu_suspend;
@@ -169,15 +169,17 @@ static int s5p64x0_pm_add(struct sys_device *sysdev)
169 return 0; 169 return 0;
170} 170}
171 171
172static struct sysdev_driver s5p64x0_pm_driver = { 172static struct subsys_interface s5p64x0_pm_interface = {
173 .add = s5p64x0_pm_add, 173 .name = "s5p64x0_pm",
174 .subsys = &s5p64x0_subsys,
175 .add_dev = s5p64x0_pm_add,
174}; 176};
175 177
176static __init int s5p64x0_pm_drvinit(void) 178static __init int s5p64x0_pm_drvinit(void)
177{ 179{
178 s3c_pm_init(); 180 s3c_pm_init();
179 181
180 return sysdev_driver_register(&s5p64x0_sysclass, &s5p64x0_pm_driver); 182 return subsys_interface_register(&s5p64x0_pm_interface);
181} 183}
182arch_initcall(s5p64x0_pm_drvinit); 184arch_initcall(s5p64x0_pm_drvinit);
183 185
diff --git a/arch/arm/mach-s5pc100/cpu.c b/arch/arm/mach-s5pc100/cpu.c
index fd2708e7d8a9..330a10b23a5d 100644
--- a/arch/arm/mach-s5pc100/cpu.c
+++ b/arch/arm/mach-s5pc100/cpu.c
@@ -21,7 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/sysdev.h> 24#include <linux/device.h>
25#include <linux/serial_core.h> 25#include <linux/serial_core.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/sched.h> 27#include <linux/sched.h>
@@ -143,17 +143,18 @@ void __init s5pc100_init_irq(void)
143 s5p_init_irq(vic, ARRAY_SIZE(vic)); 143 s5p_init_irq(vic, ARRAY_SIZE(vic));
144} 144}
145 145
146static struct sysdev_class s5pc100_sysclass = { 146static struct bus_type s5pc100_subsys = {
147 .name = "s5pc100-core", 147 .name = "s5pc100-core",
148 .dev_name = "s5pc100-core",
148}; 149};
149 150
150static struct sys_device s5pc100_sysdev = { 151static struct device s5pc100_dev = {
151 .cls = &s5pc100_sysclass, 152 .bus = &s5pc100_subsys,
152}; 153};
153 154
154static int __init s5pc100_core_init(void) 155static int __init s5pc100_core_init(void)
155{ 156{
156 return sysdev_class_register(&s5pc100_sysclass); 157 return subsys_system_register(&s5pc100_subsys, NULL);
157} 158}
158 159
159core_initcall(s5pc100_core_init); 160core_initcall(s5pc100_core_init);
@@ -165,5 +166,5 @@ int __init s5pc100_init(void)
165 /* set idle function */ 166 /* set idle function */
166 pm_idle = s5pc100_idle; 167 pm_idle = s5pc100_idle;
167 168
168 return sysdev_register(&s5pc100_sysdev); 169 return device_register(&s5pc100_dev);
169} 170}
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index 4c5ac7a69e9e..6a1e5876bb84 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -17,7 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include <mach/map.h> 23#include <mach/map.h>
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c
index 84ec74633232..28e71efb388e 100644
--- a/arch/arm/mach-s5pv210/cpu.c
+++ b/arch/arm/mach-s5pv210/cpu.c
@@ -17,7 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
@@ -174,17 +174,18 @@ void __init s5pv210_init_irq(void)
174 s5p_init_irq(vic, ARRAY_SIZE(vic)); 174 s5p_init_irq(vic, ARRAY_SIZE(vic));
175} 175}
176 176
177struct sysdev_class s5pv210_sysclass = { 177struct bus_type s5pv210_subsys = {
178 .name = "s5pv210-core", 178 .name = "s5pv210-core",
179 .dev_name = "s5pv210-core",
179}; 180};
180 181
181static struct sys_device s5pv210_sysdev = { 182static struct device s5pv210_dev = {
182 .cls = &s5pv210_sysclass, 183 .bus = &s5pv210_subsys,
183}; 184};
184 185
185static int __init s5pv210_core_init(void) 186static int __init s5pv210_core_init(void)
186{ 187{
187 return sysdev_class_register(&s5pv210_sysclass); 188 return subsys_system_register(&s5pv210_subsys, NULL);
188} 189}
189 190
190core_initcall(s5pv210_core_init); 191core_initcall(s5pv210_core_init);
@@ -199,5 +200,5 @@ int __init s5pv210_init(void)
199 /* set sw_reset function */ 200 /* set sw_reset function */
200 s5p_reset_hook = s5pv210_sw_reset; 201 s5p_reset_hook = s5pv210_sw_reset;
201 202
202 return sysdev_register(&s5pv210_sysdev); 203 return device_register(&s5pv210_dev);
203} 204}
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index f7266bb0cac8..05cf7dc61286 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/serial_core.h> 14#include <linux/serial_core.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/sysdev.h> 16#include <linux/device.h>
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 8662ef6e5681..69a99db6cc83 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -13,7 +13,7 @@
13#include <linux/i2c.h> 13#include <linux/i2c.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/serial_core.h> 15#include <linux/serial_core.h>
16#include <linux/sysdev.h> 16#include <linux/device.h>
17#include <linux/dm9000.h> 17#include <linux/dm9000.h>
18#include <linux/fb.h> 18#include <linux/fb.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c
index f149d278377b..677c71c41e50 100644
--- a/arch/arm/mach-s5pv210/pm.c
+++ b/arch/arm/mach-s5pv210/pm.c
@@ -133,7 +133,7 @@ static void s5pv210_pm_prepare(void)
133 s3c_pm_do_save(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save)); 133 s3c_pm_do_save(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save));
134} 134}
135 135
136static int s5pv210_pm_add(struct sys_device *sysdev) 136static int s5pv210_pm_add(struct device *dev)
137{ 137{
138 pm_cpu_prep = s5pv210_pm_prepare; 138 pm_cpu_prep = s5pv210_pm_prepare;
139 pm_cpu_sleep = s5pv210_cpu_suspend; 139 pm_cpu_sleep = s5pv210_cpu_suspend;
@@ -141,13 +141,15 @@ static int s5pv210_pm_add(struct sys_device *sysdev)
141 return 0; 141 return 0;
142} 142}
143 143
144static struct sysdev_driver s5pv210_pm_driver = { 144static struct subsys_interface s5pv210_pm_interface = {
145 .add = s5pv210_pm_add, 145 .name = "s5pv210_pm",
146 .subsys = &s5pv210_subsys,
147 .add_dev = s5pv210_pm_add,
146}; 148};
147 149
148static __init int s5pv210_pm_drvinit(void) 150static __init int s5pv210_pm_drvinit(void)
149{ 151{
150 return sysdev_driver_register(&s5pv210_sysclass, &s5pv210_pm_driver); 152 return subsys_interface_register(&s5pv210_pm_interface);
151} 153}
152arch_initcall(s5pv210_pm_drvinit); 154arch_initcall(s5pv210_pm_drvinit);
153 155
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index e340a54251df..3a4893b82ad1 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -22,7 +22,6 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/sysdev.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/irqdomain.h> 26#include <linux/irqdomain.h>
28#include <linux/of_address.h> 27#include <linux/of_address.h>
diff --git a/arch/arm/mach-versatile/versatile_ab.c b/arch/arm/mach-versatile/versatile_ab.c
index fda4866703cd..07b9122ff84f 100644
--- a/arch/arm/mach-versatile/versatile_ab.c
+++ b/arch/arm/mach-versatile/versatile_ab.c
@@ -21,7 +21,6 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/sysdev.h>
25#include <linux/amba/bus.h> 24#include <linux/amba/bus.h>
26#include <linux/io.h> 25#include <linux/io.h>
27 26
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c
index feaf9cbe60f6..8d8b80e79e03 100644
--- a/arch/arm/mach-versatile/versatile_pb.c
+++ b/arch/arm/mach-versatile/versatile_pb.c
@@ -21,7 +21,6 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/sysdev.h>
25#include <linux/amba/bus.h> 24#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 25#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 26#include <linux/amba/mmci.h>
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 1fafc3244607..de5a2384284b 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -10,7 +10,7 @@
10#include <linux/ata_platform.h> 10#include <linux/ata_platform.h>
11#include <linux/smsc911x.h> 11#include <linux/smsc911x.h>
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/sysdev.h> 13#include <linux/device.h>
14#include <linux/usb/isp1760.h> 14#include <linux/usb/isp1760.h>
15#include <linux/clkdev.h> 15#include <linux/clkdev.h>
16#include <linux/mtd/physmap.h> 16#include <linux/mtd/physmap.h>
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
index 7bf143c443f1..f47e29586a01 100644
--- a/arch/arm/mach-w90x900/irq.c
+++ b/arch/arm/mach-w90x900/irq.c
@@ -19,7 +19,7 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <linux/sysdev.h> 22#include <linux/device.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <asm/irq.h> 25#include <asm/irq.h>
diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/plat-s3c24xx/common-smdk.c
index bcc43f346272..084604be6ad1 100644
--- a/arch/arm/plat-s3c24xx/common-smdk.c
+++ b/arch/arm/plat-s3c24xx/common-smdk.c
@@ -19,7 +19,7 @@
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/sysdev.h> 22#include <linux/device.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25#include <linux/mtd/mtd.h> 25#include <linux/mtd/mtd.h>
diff --git a/arch/arm/plat-s3c24xx/cpu-freq.c b/arch/arm/plat-s3c24xx/cpu-freq.c
index b3d3d0278997..468079938884 100644
--- a/arch/arm/plat-s3c24xx/cpu-freq.c
+++ b/arch/arm/plat-s3c24xx/cpu-freq.c
@@ -20,7 +20,7 @@
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/sysdev.h> 23#include <linux/device.h>
24#include <linux/sysfs.h> 24#include <linux/sysfs.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c
index fc8c5f89954d..bc42c04091fd 100644
--- a/arch/arm/plat-s3c24xx/irq.c
+++ b/arch/arm/plat-s3c24xx/irq.c
@@ -22,7 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/ioport.h> 24#include <linux/ioport.h>
25#include <linux/sysdev.h> 25#include <linux/device.h>
26#include <linux/syscore_ops.h> 26#include <linux/syscore_ops.h>
27 27
28#include <asm/irq.h> 28#include <asm/irq.h>
diff --git a/arch/arm/plat-s3c24xx/pm-simtec.c b/arch/arm/plat-s3c24xx/pm-simtec.c
index 663b280d65da..68296b1fe7e5 100644
--- a/arch/arm/plat-s3c24xx/pm-simtec.c
+++ b/arch/arm/plat-s3c24xx/pm-simtec.c
@@ -18,7 +18,6 @@
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/sysdev.h>
22#include <linux/device.h> 21#include <linux/device.h>
23#include <linux/io.h> 22#include <linux/io.h>
24 23
diff --git a/arch/arm/plat-s3c24xx/s3c2410-clock.c b/arch/arm/plat-s3c24xx/s3c2410-clock.c
index def76aa3825a..25dc4d4397b1 100644
--- a/arch/arm/plat-s3c24xx/s3c2410-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c2410-clock.c
@@ -26,7 +26,7 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/sysdev.h> 29#include <linux/device.h>
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
diff --git a/arch/arm/plat-s3c24xx/s3c2412-iotiming.c b/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
index 0b46d3895d62..48eee39ab369 100644
--- a/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
+++ b/arch/arm/plat-s3c24xx/s3c2412-iotiming.c
@@ -17,7 +17,7 @@
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/err.h> 23#include <linux/err.h>
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index 5f84a3f13ef9..963edea7f7e7 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -17,7 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/sysdev.h> 20#include <linux/device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <asm/div64.h> 22#include <asm/div64.h>
23 23
diff --git a/arch/arm/plat-s5p/irq-eint.c b/arch/arm/plat-s5p/irq-eint.c
index b5bb774985b0..c496b359c371 100644
--- a/arch/arm/plat-s5p/irq-eint.c
+++ b/arch/arm/plat-s5p/irq-eint.c
@@ -14,7 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19 19
20#include <asm/hardware/vic.h> 20#include <asm/hardware/vic.h>
diff --git a/arch/arm/plat-samsung/clock-clksrc.c b/arch/arm/plat-samsung/clock-clksrc.c
index ae8b8507663f..786a4107a157 100644
--- a/arch/arm/plat-samsung/clock-clksrc.c
+++ b/arch/arm/plat-samsung/clock-clksrc.c
@@ -16,7 +16,7 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/sysdev.h> 19#include <linux/device.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <plat/clock.h> 22#include <plat/clock.h>
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index 3b4451979d1b..10f71179071f 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -33,7 +33,7 @@
33#include <linux/errno.h> 33#include <linux/errno.h>
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/sysdev.h> 36#include <linux/device.h>
37#include <linux/interrupt.h> 37#include <linux/interrupt.h>
38#include <linux/ioport.h> 38#include <linux/ioport.h>
39#include <linux/clk.h> 39#include <linux/clk.h>
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 40fd7b6b5e66..0122a22eb732 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -185,20 +185,20 @@ extern struct syscore_ops s3c2416_pm_syscore_ops;
185extern struct syscore_ops s3c244x_pm_syscore_ops; 185extern struct syscore_ops s3c244x_pm_syscore_ops;
186extern struct syscore_ops s3c64xx_irq_syscore_ops; 186extern struct syscore_ops s3c64xx_irq_syscore_ops;
187 187
188/* system device classes */ 188/* system device subsystems */
189 189
190extern struct sysdev_class s3c2410_sysclass; 190extern struct bus_type s3c2410_subsys;
191extern struct sysdev_class s3c2410a_sysclass; 191extern struct bus_type s3c2410a_subsys;
192extern struct sysdev_class s3c2412_sysclass; 192extern struct bus_type s3c2412_subsys;
193extern struct sysdev_class s3c2416_sysclass; 193extern struct bus_type s3c2416_subsys;
194extern struct sysdev_class s3c2440_sysclass; 194extern struct bus_type s3c2440_subsys;
195extern struct sysdev_class s3c2442_sysclass; 195extern struct bus_type s3c2442_subsys;
196extern struct sysdev_class s3c2443_sysclass; 196extern struct bus_type s3c2443_subsys;
197extern struct sysdev_class s3c6410_sysclass; 197extern struct bus_type s3c6410_subsys;
198extern struct sysdev_class s3c64xx_sysclass; 198extern struct bus_type s3c64xx_subsys;
199extern struct sysdev_class s5p64x0_sysclass; 199extern struct bus_type s5p64x0_subsys;
200extern struct sysdev_class s5pv210_sysclass; 200extern struct bus_type s5pv210_subsys;
201extern struct sysdev_class exynos4_sysclass; 201extern struct bus_type exynos4_subsys;
202 202
203extern void (*s5pc1xx_idle)(void); 203extern void (*s5pc1xx_idle)(void);
204 204
diff --git a/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h b/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
index 1c1ed5481253..d01576318b2c 100644
--- a/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
+++ b/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
@@ -12,7 +12,7 @@
12 12
13#include <plat/dma-core.h> 13#include <plat/dma-core.h>
14 14
15extern struct sysdev_class dma_sysclass; 15extern struct bus_type dma_subsys;
16extern struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS]; 16extern struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS];
17 17
18#define DMA_CH_VALID (1<<31) 18#define DMA_CH_VALID (1<<31)
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index dcf68709f9cf..78014e53eb3c 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -17,7 +17,7 @@
17 17
18#include <linux/irq.h> 18#include <linux/irq.h>
19 19
20struct sys_device; 20struct device;
21 21
22#ifdef CONFIG_PM 22#ifdef CONFIG_PM
23 23
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index 4be016eaa6db..c2ff92c30bdf 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -14,7 +14,7 @@
14*/ 14*/
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
diff --git a/arch/arm/plat-samsung/wakeup-mask.c b/arch/arm/plat-samsung/wakeup-mask.c
index dc814037297b..20c3d9117cc2 100644
--- a/arch/arm/plat-samsung/wakeup-mask.c
+++ b/arch/arm/plat-samsung/wakeup-mask.c
@@ -11,7 +11,7 @@
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/sysdev.h> 14#include <linux/device.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/io.h> 17#include <linux/io.h>
diff --git a/arch/avr32/boards/merisc/merisc_sysfs.c b/arch/avr32/boards/merisc/merisc_sysfs.c
index df431fdba9ad..5a252318f4bd 100644
--- a/arch/avr32/boards/merisc/merisc_sysfs.c
+++ b/arch/avr32/boards/merisc/merisc_sysfs.c
@@ -13,7 +13,6 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/sysdev.h>
17#include <linux/timer.h> 16#include <linux/timer.h>
18#include <linux/err.h> 17#include <linux/err.h>
19#include <linux/ctype.h> 18#include <linux/ctype.h>
diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c
index e84faffbbeca..2233be71e2e8 100644
--- a/arch/avr32/kernel/cpu.c
+++ b/arch/avr32/kernel/cpu.c
@@ -6,7 +6,7 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/sysdev.h> 9#include <linux/device.h>
10#include <linux/seq_file.h> 10#include <linux/seq_file.h>
11#include <linux/cpu.h> 11#include <linux/cpu.h>
12#include <linux/module.h> 12#include <linux/module.h>
@@ -26,16 +26,16 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
26 * XXX: If/when a SMP-capable implementation of AVR32 will ever be 26 * XXX: If/when a SMP-capable implementation of AVR32 will ever be
27 * made, we must make sure that the code executes on the correct CPU. 27 * made, we must make sure that the code executes on the correct CPU.
28 */ 28 */
29static ssize_t show_pc0event(struct sys_device *dev, 29static ssize_t show_pc0event(struct device *dev,
30 struct sysdev_attribute *attr, char *buf) 30 struct device_attribute *attr, char *buf)
31{ 31{
32 unsigned long pccr; 32 unsigned long pccr;
33 33
34 pccr = sysreg_read(PCCR); 34 pccr = sysreg_read(PCCR);
35 return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); 35 return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f);
36} 36}
37static ssize_t store_pc0event(struct sys_device *dev, 37static ssize_t store_pc0event(struct device *dev,
38 struct sysdev_attribute *attr, const char *buf, 38 struct device_attribute *attr, const char *buf,
39 size_t count) 39 size_t count)
40{ 40{
41 unsigned long val; 41 unsigned long val;
@@ -48,16 +48,16 @@ static ssize_t store_pc0event(struct sys_device *dev,
48 sysreg_write(PCCR, val); 48 sysreg_write(PCCR, val);
49 return count; 49 return count;
50} 50}
51static ssize_t show_pc0count(struct sys_device *dev, 51static ssize_t show_pc0count(struct device *dev,
52 struct sysdev_attribute *attr, char *buf) 52 struct device_attribute *attr, char *buf)
53{ 53{
54 unsigned long pcnt0; 54 unsigned long pcnt0;
55 55
56 pcnt0 = sysreg_read(PCNT0); 56 pcnt0 = sysreg_read(PCNT0);
57 return sprintf(buf, "%lu\n", pcnt0); 57 return sprintf(buf, "%lu\n", pcnt0);
58} 58}
59static ssize_t store_pc0count(struct sys_device *dev, 59static ssize_t store_pc0count(struct device *dev,
60 struct sysdev_attribute *attr, 60 struct device_attribute *attr,
61 const char *buf, size_t count) 61 const char *buf, size_t count)
62{ 62{
63 unsigned long val; 63 unsigned long val;
@@ -71,16 +71,16 @@ static ssize_t store_pc0count(struct sys_device *dev,
71 return count; 71 return count;
72} 72}
73 73
74static ssize_t show_pc1event(struct sys_device *dev, 74static ssize_t show_pc1event(struct device *dev,
75 struct sysdev_attribute *attr, char *buf) 75 struct device_attribute *attr, char *buf)
76{ 76{
77 unsigned long pccr; 77 unsigned long pccr;
78 78
79 pccr = sysreg_read(PCCR); 79 pccr = sysreg_read(PCCR);
80 return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); 80 return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f);
81} 81}
82static ssize_t store_pc1event(struct sys_device *dev, 82static ssize_t store_pc1event(struct device *dev,
83 struct sysdev_attribute *attr, const char *buf, 83 struct device_attribute *attr, const char *buf,
84 size_t count) 84 size_t count)
85{ 85{
86 unsigned long val; 86 unsigned long val;
@@ -93,16 +93,16 @@ static ssize_t store_pc1event(struct sys_device *dev,
93 sysreg_write(PCCR, val); 93 sysreg_write(PCCR, val);
94 return count; 94 return count;
95} 95}
96static ssize_t show_pc1count(struct sys_device *dev, 96static ssize_t show_pc1count(struct device *dev,
97 struct sysdev_attribute *attr, char *buf) 97 struct device_attribute *attr, char *buf)
98{ 98{
99 unsigned long pcnt1; 99 unsigned long pcnt1;
100 100
101 pcnt1 = sysreg_read(PCNT1); 101 pcnt1 = sysreg_read(PCNT1);
102 return sprintf(buf, "%lu\n", pcnt1); 102 return sprintf(buf, "%lu\n", pcnt1);
103} 103}
104static ssize_t store_pc1count(struct sys_device *dev, 104static ssize_t store_pc1count(struct device *dev,
105 struct sysdev_attribute *attr, const char *buf, 105 struct device_attribute *attr, const char *buf,
106 size_t count) 106 size_t count)
107{ 107{
108 unsigned long val; 108 unsigned long val;
@@ -116,16 +116,16 @@ static ssize_t store_pc1count(struct sys_device *dev,
116 return count; 116 return count;
117} 117}
118 118
119static ssize_t show_pccycles(struct sys_device *dev, 119static ssize_t show_pccycles(struct device *dev,
120 struct sysdev_attribute *attr, char *buf) 120 struct device_attribute *attr, char *buf)
121{ 121{
122 unsigned long pccnt; 122 unsigned long pccnt;
123 123
124 pccnt = sysreg_read(PCCNT); 124 pccnt = sysreg_read(PCCNT);
125 return sprintf(buf, "%lu\n", pccnt); 125 return sprintf(buf, "%lu\n", pccnt);
126} 126}
127static ssize_t store_pccycles(struct sys_device *dev, 127static ssize_t store_pccycles(struct device *dev,
128 struct sysdev_attribute *attr, const char *buf, 128 struct device_attribute *attr, const char *buf,
129 size_t count) 129 size_t count)
130{ 130{
131 unsigned long val; 131 unsigned long val;
@@ -139,16 +139,16 @@ static ssize_t store_pccycles(struct sys_device *dev,
139 return count; 139 return count;
140} 140}
141 141
142static ssize_t show_pcenable(struct sys_device *dev, 142static ssize_t show_pcenable(struct device *dev,
143 struct sysdev_attribute *attr, char *buf) 143 struct device_attribute *attr, char *buf)
144{ 144{
145 unsigned long pccr; 145 unsigned long pccr;
146 146
147 pccr = sysreg_read(PCCR); 147 pccr = sysreg_read(PCCR);
148 return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); 148 return sprintf(buf, "%c\n", (pccr & 1)?'1':'0');
149} 149}
150static ssize_t store_pcenable(struct sys_device *dev, 150static ssize_t store_pcenable(struct device *dev,
151 struct sysdev_attribute *attr, const char *buf, 151 struct device_attribute *attr, const char *buf,
152 size_t count) 152 size_t count)
153{ 153{
154 unsigned long pccr, val; 154 unsigned long pccr, val;
@@ -167,12 +167,12 @@ static ssize_t store_pcenable(struct sys_device *dev,
167 return count; 167 return count;
168} 168}
169 169
170static SYSDEV_ATTR(pc0event, 0600, show_pc0event, store_pc0event); 170static DEVICE_ATTR(pc0event, 0600, show_pc0event, store_pc0event);
171static SYSDEV_ATTR(pc0count, 0600, show_pc0count, store_pc0count); 171static DEVICE_ATTR(pc0count, 0600, show_pc0count, store_pc0count);
172static SYSDEV_ATTR(pc1event, 0600, show_pc1event, store_pc1event); 172static DEVICE_ATTR(pc1event, 0600, show_pc1event, store_pc1event);
173static SYSDEV_ATTR(pc1count, 0600, show_pc1count, store_pc1count); 173static DEVICE_ATTR(pc1count, 0600, show_pc1count, store_pc1count);
174static SYSDEV_ATTR(pccycles, 0600, show_pccycles, store_pccycles); 174static DEVICE_ATTR(pccycles, 0600, show_pccycles, store_pccycles);
175static SYSDEV_ATTR(pcenable, 0600, show_pcenable, store_pcenable); 175static DEVICE_ATTR(pcenable, 0600, show_pcenable, store_pcenable);
176 176
177#endif /* CONFIG_PERFORMANCE_COUNTERS */ 177#endif /* CONFIG_PERFORMANCE_COUNTERS */
178 178
@@ -186,12 +186,12 @@ static int __init topology_init(void)
186 register_cpu(c, cpu); 186 register_cpu(c, cpu);
187 187
188#ifdef CONFIG_PERFORMANCE_COUNTERS 188#ifdef CONFIG_PERFORMANCE_COUNTERS
189 sysdev_create_file(&c->sysdev, &attr_pc0event); 189 device_create_file(&c->dev, &dev_attr_pc0event);
190 sysdev_create_file(&c->sysdev, &attr_pc0count); 190 device_create_file(&c->dev, &dev_attr_pc0count);
191 sysdev_create_file(&c->sysdev, &attr_pc1event); 191 device_create_file(&c->dev, &dev_attr_pc1event);
192 sysdev_create_file(&c->sysdev, &attr_pc1count); 192 device_create_file(&c->dev, &dev_attr_pc1count);
193 sysdev_create_file(&c->sysdev, &attr_pccycles); 193 device_create_file(&c->dev, &dev_attr_pccycles);
194 sysdev_create_file(&c->sysdev, &attr_pcenable); 194 device_create_file(&c->dev, &dev_attr_pcenable);
195#endif 195#endif
196 } 196 }
197 197
diff --git a/arch/avr32/kernel/irq.c b/arch/avr32/kernel/irq.c
index bc3aa18293df..900e49b2258b 100644
--- a/arch/avr32/kernel/irq.c
+++ b/arch/avr32/kernel/irq.c
@@ -14,7 +14,7 @@
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/proc_fs.h> 15#include <linux/proc_fs.h>
16#include <linux/seq_file.h> 16#include <linux/seq_file.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18 18
19/* May be overridden by platform code */ 19/* May be overridden by platform code */
20int __weak nmi_enable(void) 20int __weak nmi_enable(void)
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index c539c689493b..2d67317a1ec2 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -24,7 +24,7 @@
24 * Copyright (C) 2006, Intel Corp. All rights reserved. 24 * Copyright (C) 2006, Intel Corp. All rights reserved.
25 * 25 *
26 */ 26 */
27#include <linux/sysdev.h> 27#include <linux/device.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/cpu.h> 30#include <linux/cpu.h>
@@ -35,10 +35,10 @@
35#define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte; 35#define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte;
36 36
37#define define_one_ro(name) \ 37#define define_one_ro(name) \
38static SYSDEV_ATTR(name, 0444, show_##name, NULL) 38static DEVICE_ATTR(name, 0444, show_##name, NULL)
39 39
40#define define_one_rw(name) \ 40#define define_one_rw(name) \
41static SYSDEV_ATTR(name, 0644, show_##name, store_##name) 41static DEVICE_ATTR(name, 0644, show_##name, store_##name)
42 42
43static u64 call_start[NR_CPUS]; 43static u64 call_start[NR_CPUS];
44static u64 phys_addr[NR_CPUS]; 44static u64 phys_addr[NR_CPUS];
@@ -55,7 +55,7 @@ static u64 resources[NR_CPUS];
55 55
56#define show(name) \ 56#define show(name) \
57static ssize_t \ 57static ssize_t \
58show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ 58show_##name(struct device *dev, struct device_attribute *attr, \
59 char *buf) \ 59 char *buf) \
60{ \ 60{ \
61 u32 cpu=dev->id; \ 61 u32 cpu=dev->id; \
@@ -64,7 +64,7 @@ show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \
64 64
65#define store(name) \ 65#define store(name) \
66static ssize_t \ 66static ssize_t \
67store_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ 67store_##name(struct device *dev, struct device_attribute *attr, \
68 const char *buf, size_t size) \ 68 const char *buf, size_t size) \
69{ \ 69{ \
70 unsigned int cpu=dev->id; \ 70 unsigned int cpu=dev->id; \
@@ -78,7 +78,7 @@ show(call_start)
78 * processor. The cpu number in driver is only used for storing data. 78 * processor. The cpu number in driver is only used for storing data.
79 */ 79 */
80static ssize_t 80static ssize_t
81store_call_start(struct sys_device *dev, struct sysdev_attribute *attr, 81store_call_start(struct device *dev, struct device_attribute *attr,
82 const char *buf, size_t size) 82 const char *buf, size_t size)
83{ 83{
84 unsigned int cpu=dev->id; 84 unsigned int cpu=dev->id;
@@ -127,7 +127,7 @@ show(err_type_info)
127store(err_type_info) 127store(err_type_info)
128 128
129static ssize_t 129static ssize_t
130show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, 130show_virtual_to_phys(struct device *dev, struct device_attribute *attr,
131 char *buf) 131 char *buf)
132{ 132{
133 unsigned int cpu=dev->id; 133 unsigned int cpu=dev->id;
@@ -135,7 +135,7 @@ show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr,
135} 135}
136 136
137static ssize_t 137static ssize_t
138store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, 138store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
139 const char *buf, size_t size) 139 const char *buf, size_t size)
140{ 140{
141 unsigned int cpu=dev->id; 141 unsigned int cpu=dev->id;
@@ -159,8 +159,8 @@ show(err_struct_info)
159store(err_struct_info) 159store(err_struct_info)
160 160
161static ssize_t 161static ssize_t
162show_err_data_buffer(struct sys_device *dev, 162show_err_data_buffer(struct device *dev,
163 struct sysdev_attribute *attr, char *buf) 163 struct device_attribute *attr, char *buf)
164{ 164{
165 unsigned int cpu=dev->id; 165 unsigned int cpu=dev->id;
166 166
@@ -171,8 +171,8 @@ show_err_data_buffer(struct sys_device *dev,
171} 171}
172 172
173static ssize_t 173static ssize_t
174store_err_data_buffer(struct sys_device *dev, 174store_err_data_buffer(struct device *dev,
175 struct sysdev_attribute *attr, 175 struct device_attribute *attr,
176 const char *buf, size_t size) 176 const char *buf, size_t size)
177{ 177{
178 unsigned int cpu=dev->id; 178 unsigned int cpu=dev->id;
@@ -209,14 +209,14 @@ define_one_ro(capabilities);
209define_one_ro(resources); 209define_one_ro(resources);
210 210
211static struct attribute *default_attrs[] = { 211static struct attribute *default_attrs[] = {
212 &attr_call_start.attr, 212 &dev_attr_call_start.attr,
213 &attr_virtual_to_phys.attr, 213 &dev_attr_virtual_to_phys.attr,
214 &attr_err_type_info.attr, 214 &dev_attr_err_type_info.attr,
215 &attr_err_struct_info.attr, 215 &dev_attr_err_struct_info.attr,
216 &attr_err_data_buffer.attr, 216 &dev_attr_err_data_buffer.attr,
217 &attr_status.attr, 217 &dev_attr_status.attr,
218 &attr_capabilities.attr, 218 &dev_attr_capabilities.attr,
219 &attr_resources.attr, 219 &dev_attr_resources.attr,
220 NULL 220 NULL
221}; 221};
222 222
@@ -225,12 +225,12 @@ static struct attribute_group err_inject_attr_group = {
225 .name = "err_inject" 225 .name = "err_inject"
226}; 226};
227/* Add/Remove err_inject interface for CPU device */ 227/* Add/Remove err_inject interface for CPU device */
228static int __cpuinit err_inject_add_dev(struct sys_device * sys_dev) 228static int __cpuinit err_inject_add_dev(struct device * sys_dev)
229{ 229{
230 return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group); 230 return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group);
231} 231}
232 232
233static int __cpuinit err_inject_remove_dev(struct sys_device * sys_dev) 233static int __cpuinit err_inject_remove_dev(struct device * sys_dev)
234{ 234{
235 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); 235 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
236 return 0; 236 return 0;
@@ -239,9 +239,9 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb,
239 unsigned long action, void *hcpu) 239 unsigned long action, void *hcpu)
240{ 240{
241 unsigned int cpu = (unsigned long)hcpu; 241 unsigned int cpu = (unsigned long)hcpu;
242 struct sys_device *sys_dev; 242 struct device *sys_dev;
243 243
244 sys_dev = get_cpu_sysdev(cpu); 244 sys_dev = get_cpu_device(cpu);
245 switch (action) { 245 switch (action) {
246 case CPU_ONLINE: 246 case CPU_ONLINE:
247 case CPU_ONLINE_FROZEN: 247 case CPU_ONLINE_FROZEN:
@@ -283,13 +283,13 @@ static void __exit
283err_inject_exit(void) 283err_inject_exit(void)
284{ 284{
285 int i; 285 int i;
286 struct sys_device *sys_dev; 286 struct device *sys_dev;
287 287
288#ifdef ERR_INJ_DEBUG 288#ifdef ERR_INJ_DEBUG
289 printk(KERN_INFO "Exit error injection driver.\n"); 289 printk(KERN_INFO "Exit error injection driver.\n");
290#endif 290#endif
291 for_each_online_cpu(i) { 291 for_each_online_cpu(i) {
292 sys_dev = get_cpu_sysdev(i); 292 sys_dev = get_cpu_device(i);
293 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); 293 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
294 } 294 }
295 unregister_hotcpu_notifier(&err_inject_cpu_notifier); 295 unregister_hotcpu_notifier(&err_inject_cpu_notifier);
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index 9be1f11a01d9..9deb21dbf629 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -350,7 +350,7 @@ static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu)
350} 350}
351 351
352/* Add cache interface for CPU device */ 352/* Add cache interface for CPU device */
353static int __cpuinit cache_add_dev(struct sys_device * sys_dev) 353static int __cpuinit cache_add_dev(struct device * sys_dev)
354{ 354{
355 unsigned int cpu = sys_dev->id; 355 unsigned int cpu = sys_dev->id;
356 unsigned long i, j; 356 unsigned long i, j;
@@ -400,7 +400,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
400} 400}
401 401
402/* Remove cache interface for CPU device */ 402/* Remove cache interface for CPU device */
403static int __cpuinit cache_remove_dev(struct sys_device * sys_dev) 403static int __cpuinit cache_remove_dev(struct device * sys_dev)
404{ 404{
405 unsigned int cpu = sys_dev->id; 405 unsigned int cpu = sys_dev->id;
406 unsigned long i; 406 unsigned long i;
@@ -428,9 +428,9 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
428 unsigned long action, void *hcpu) 428 unsigned long action, void *hcpu)
429{ 429{
430 unsigned int cpu = (unsigned long)hcpu; 430 unsigned int cpu = (unsigned long)hcpu;
431 struct sys_device *sys_dev; 431 struct device *sys_dev;
432 432
433 sys_dev = get_cpu_sysdev(cpu); 433 sys_dev = get_cpu_device(cpu);
434 switch (action) { 434 switch (action) {
435 case CPU_ONLINE: 435 case CPU_ONLINE:
436 case CPU_ONLINE_FROZEN: 436 case CPU_ONLINE_FROZEN:
@@ -454,7 +454,7 @@ static int __init cache_sysfs_init(void)
454 int i; 454 int i;
455 455
456 for_each_online_cpu(i) { 456 for_each_online_cpu(i) {
457 struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i); 457 struct device *sys_dev = get_cpu_device((unsigned int)i);
458 cache_add_dev(sys_dev); 458 cache_add_dev(sys_dev);
459 } 459 }
460 460
diff --git a/arch/m68k/platform/coldfire/gpio.c b/arch/m68k/platform/coldfire/gpio.c
index ff0045793450..292a1a5a2d7c 100644
--- a/arch/m68k/platform/coldfire/gpio.c
+++ b/arch/m68k/platform/coldfire/gpio.c
@@ -15,7 +15,7 @@
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/sysdev.h> 18#include <linux/device.h>
19 19
20#include <asm/gpio.h> 20#include <asm/gpio.h>
21#include <asm/pinmux.h> 21#include <asm/pinmux.h>
@@ -115,13 +115,14 @@ void mcf_gpio_free(struct gpio_chip *chip, unsigned offset)
115 mcf_pinmux_release(mcf_chip->gpio_to_pinmux[offset], 0); 115 mcf_pinmux_release(mcf_chip->gpio_to_pinmux[offset], 0);
116} 116}
117 117
118struct sysdev_class mcf_gpio_sysclass = { 118struct bus_type mcf_gpio_subsys = {
119 .name = "gpio", 119 .name = "gpio",
120 .dev_name = "gpio",
120}; 121};
121 122
122static int __init mcf_gpio_sysinit(void) 123static int __init mcf_gpio_sysinit(void)
123{ 124{
124 return sysdev_class_register(&mcf_gpio_sysclass); 125 return subsys_system_register(&mcf_gpio_subsys, NULL);
125} 126}
126 127
127core_initcall(mcf_gpio_sysinit); 128core_initcall(mcf_gpio_sysinit);
diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c
index 7f8416f86222..8e93b2122524 100644
--- a/arch/mips/txx9/generic/7segled.c
+++ b/arch/mips/txx9/generic/7segled.c
@@ -9,7 +9,7 @@
9 * (C) Copyright TOSHIBA CORPORATION 2005-2007 9 * (C) Copyright TOSHIBA CORPORATION 2005-2007
10 * All Rights Reserved. 10 * All Rights Reserved.
11 */ 11 */
12#include <linux/sysdev.h> 12#include <linux/device.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/map_to_7segment.h> 14#include <linux/map_to_7segment.h>
15#include <asm/txx9/generic.h> 15#include <asm/txx9/generic.h>
@@ -37,8 +37,8 @@ int txx9_7segled_putc(unsigned int pos, char c)
37 return 0; 37 return 0;
38} 38}
39 39
40static ssize_t ascii_store(struct sys_device *dev, 40static ssize_t ascii_store(struct device *dev,
41 struct sysdev_attribute *attr, 41 struct device_attribute *attr,
42 const char *buf, size_t size) 42 const char *buf, size_t size)
43{ 43{
44 unsigned int ch = dev->id; 44 unsigned int ch = dev->id;
@@ -46,8 +46,8 @@ static ssize_t ascii_store(struct sys_device *dev,
46 return size; 46 return size;
47} 47}
48 48
49static ssize_t raw_store(struct sys_device *dev, 49static ssize_t raw_store(struct device *dev,
50 struct sysdev_attribute *attr, 50 struct device_attribute *attr,
51 const char *buf, size_t size) 51 const char *buf, size_t size)
52{ 52{
53 unsigned int ch = dev->id; 53 unsigned int ch = dev->id;
@@ -55,19 +55,19 @@ static ssize_t raw_store(struct sys_device *dev,
55 return size; 55 return size;
56} 56}
57 57
58static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store); 58static DEVICE_ATTR(ascii, 0200, NULL, ascii_store);
59static SYSDEV_ATTR(raw, 0200, NULL, raw_store); 59static DEVICE_ATTR(raw, 0200, NULL, raw_store);
60 60
61static ssize_t map_seg7_show(struct sysdev_class *class, 61static ssize_t map_seg7_show(struct device *dev,
62 struct sysdev_class_attribute *attr, 62 struct device_attribute *attr,
63 char *buf) 63 char *buf)
64{ 64{
65 memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); 65 memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map));
66 return sizeof(txx9_seg7map); 66 return sizeof(txx9_seg7map);
67} 67}
68 68
69static ssize_t map_seg7_store(struct sysdev_class *class, 69static ssize_t map_seg7_store(struct device *dev,
70 struct sysdev_class_attribute *attr, 70 struct device_attribute *attr,
71 const char *buf, size_t size) 71 const char *buf, size_t size)
72{ 72{
73 if (size != sizeof(txx9_seg7map)) 73 if (size != sizeof(txx9_seg7map))
@@ -76,10 +76,11 @@ static ssize_t map_seg7_store(struct sysdev_class *class,
76 return size; 76 return size;
77} 77}
78 78
79static SYSDEV_CLASS_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store); 79static DEVICE_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store);
80 80
81static struct sysdev_class tx_7segled_sysdev_class = { 81static struct bus_type tx_7segled_subsys = {
82 .name = "7segled", 82 .name = "7segled",
83 .dev_name = "7segled",
83}; 84};
84 85
85static int __init tx_7segled_init_sysfs(void) 86static int __init tx_7segled_init_sysfs(void)
@@ -87,26 +88,25 @@ static int __init tx_7segled_init_sysfs(void)
87 int error, i; 88 int error, i;
88 if (!tx_7segled_num) 89 if (!tx_7segled_num)
89 return -ENODEV; 90 return -ENODEV;
90 error = sysdev_class_register(&tx_7segled_sysdev_class); 91 error = subsys_system_register(&tx_7segled_subsys, NULL);
91 if (error) 92 if (error)
92 return error; 93 return error;
93 error = sysdev_class_create_file(&tx_7segled_sysdev_class, 94 error = device_create_file(tx_7segled_subsys.dev_root, &dev_attr_map_seg7);
94 &attr_map_seg7);
95 if (error) 95 if (error)
96 return error; 96 return error;
97 for (i = 0; i < tx_7segled_num; i++) { 97 for (i = 0; i < tx_7segled_num; i++) {
98 struct sys_device *dev; 98 struct device *dev;
99 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 99 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
100 if (!dev) { 100 if (!dev) {
101 error = -ENODEV; 101 error = -ENODEV;
102 break; 102 break;
103 } 103 }
104 dev->id = i; 104 dev->id = i;
105 dev->cls = &tx_7segled_sysdev_class; 105 dev->dev = &tx_7segled_subsys;
106 error = sysdev_register(dev); 106 error = device_register(dev);
107 if (!error) { 107 if (!error) {
108 sysdev_create_file(dev, &attr_ascii); 108 device_create_file(dev, &dev_attr_ascii);
109 sysdev_create_file(dev, &attr_raw); 109 device_create_file(dev, &dev_attr_raw);
110 } 110 }
111 } 111 }
112 return error; 112 return error;
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index ec38e00b2559..ae77a7916c03 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -22,7 +22,7 @@
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/leds.h> 24#include <linux/leds.h>
25#include <linux/sysdev.h> 25#include <linux/device.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
@@ -897,10 +897,13 @@ void __init txx9_aclc_init(unsigned long baseaddr, int irq,
897#endif 897#endif
898} 898}
899 899
900static struct sysdev_class txx9_sramc_sysdev_class; 900static struct bus_type txx9_sramc_subsys = {
901 .name = "txx9_sram",
902 .dev_name = "txx9_sram",
903};
901 904
902struct txx9_sramc_sysdev { 905struct txx9_sramc_dev {
903 struct sys_device dev; 906 struct device dev;
904 struct bin_attribute bindata_attr; 907 struct bin_attribute bindata_attr;
905 void __iomem *base; 908 void __iomem *base;
906}; 909};
@@ -909,7 +912,7 @@ static ssize_t txx9_sram_read(struct file *filp, struct kobject *kobj,
909 struct bin_attribute *bin_attr, 912 struct bin_attribute *bin_attr,
910 char *buf, loff_t pos, size_t size) 913 char *buf, loff_t pos, size_t size)
911{ 914{
912 struct txx9_sramc_sysdev *dev = bin_attr->private; 915 struct txx9_sramc_dev *dev = bin_attr->private;
913 size_t ramsize = bin_attr->size; 916 size_t ramsize = bin_attr->size;
914 917
915 if (pos >= ramsize) 918 if (pos >= ramsize)
@@ -924,7 +927,7 @@ static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj,
924 struct bin_attribute *bin_attr, 927 struct bin_attribute *bin_attr,
925 char *buf, loff_t pos, size_t size) 928 char *buf, loff_t pos, size_t size)
926{ 929{
927 struct txx9_sramc_sysdev *dev = bin_attr->private; 930 struct txx9_sramc_dev *dev = bin_attr->private;
928 size_t ramsize = bin_attr->size; 931 size_t ramsize = bin_attr->size;
929 932
930 if (pos >= ramsize) 933 if (pos >= ramsize)
@@ -937,18 +940,13 @@ static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj,
937 940
938void __init txx9_sramc_init(struct resource *r) 941void __init txx9_sramc_init(struct resource *r)
939{ 942{
940 struct txx9_sramc_sysdev *dev; 943 struct txx9_sramc_dev *dev;
941 size_t size; 944 size_t size;
942 int err; 945 int err;
943 946
944 if (!txx9_sramc_sysdev_class.name) { 947 err = subsys_system_register(&txx9_sramc_subsys, NULL);
945 txx9_sramc_sysdev_class.name = "txx9_sram"; 948 if (err)
946 err = sysdev_class_register(&txx9_sramc_sysdev_class); 949 return;
947 if (err) {
948 txx9_sramc_sysdev_class.name = NULL;
949 return;
950 }
951 }
952 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 950 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
953 if (!dev) 951 if (!dev)
954 return; 952 return;
@@ -956,7 +954,7 @@ void __init txx9_sramc_init(struct resource *r)
956 dev->base = ioremap(r->start, size); 954 dev->base = ioremap(r->start, size);
957 if (!dev->base) 955 if (!dev->base)
958 goto exit; 956 goto exit;
959 dev->dev.cls = &txx9_sramc_sysdev_class; 957 dev->dev.bus = &txx9_sramc_subsys;
960 sysfs_bin_attr_init(&dev->bindata_attr); 958 sysfs_bin_attr_init(&dev->bindata_attr);
961 dev->bindata_attr.attr.name = "bindata"; 959 dev->bindata_attr.attr.name = "bindata";
962 dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR; 960 dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR;
@@ -964,12 +962,12 @@ void __init txx9_sramc_init(struct resource *r)
964 dev->bindata_attr.write = txx9_sram_write; 962 dev->bindata_attr.write = txx9_sram_write;
965 dev->bindata_attr.size = size; 963 dev->bindata_attr.size = size;
966 dev->bindata_attr.private = dev; 964 dev->bindata_attr.private = dev;
967 err = sysdev_register(&dev->dev); 965 err = device_register(&dev->dev);
968 if (err) 966 if (err)
969 goto exit; 967 goto exit;
970 err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); 968 err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr);
971 if (err) { 969 if (err) {
972 sysdev_unregister(&dev->dev); 970 device_unregister(&dev->dev);
973 goto exit; 971 goto exit;
974 } 972 }
975 return; 973 return;
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index ba3cec3155df..6567895d1f59 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -15,7 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/sysdev.h> 18#include <linux/device.h>
19#include <linux/ethtool.h> 19#include <linux/ethtool.h>
20#include <linux/param.h> 20#include <linux/param.h>
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
diff --git a/arch/powerpc/include/asm/spu.h b/arch/powerpc/include/asm/spu.h
index 4e360bd4a35a..fff921345ddc 100644
--- a/arch/powerpc/include/asm/spu.h
+++ b/arch/powerpc/include/asm/spu.h
@@ -25,7 +25,7 @@
25#ifdef __KERNEL__ 25#ifdef __KERNEL__
26 26
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/sysdev.h> 28#include <linux/device.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30 30
31#define LS_SIZE (256 * 1024) 31#define LS_SIZE (256 * 1024)
@@ -166,7 +166,7 @@ struct spu {
166 /* beat only */ 166 /* beat only */
167 u64 shadow_int_mask_RW[3]; 167 u64 shadow_int_mask_RW[3];
168 168
169 struct sys_device sysdev; 169 struct device dev;
170 170
171 int has_mem_affinity; 171 int has_mem_affinity;
172 struct list_head aff_list; 172 struct list_head aff_list;
@@ -270,11 +270,11 @@ struct spufs_calls {
270int register_spu_syscalls(struct spufs_calls *calls); 270int register_spu_syscalls(struct spufs_calls *calls);
271void unregister_spu_syscalls(struct spufs_calls *calls); 271void unregister_spu_syscalls(struct spufs_calls *calls);
272 272
273int spu_add_sysdev_attr(struct sysdev_attribute *attr); 273int spu_add_dev_attr(struct device_attribute *attr);
274void spu_remove_sysdev_attr(struct sysdev_attribute *attr); 274void spu_remove_dev_attr(struct device_attribute *attr);
275 275
276int spu_add_sysdev_attr_group(struct attribute_group *attrs); 276int spu_add_dev_attr_group(struct attribute_group *attrs);
277void spu_remove_sysdev_attr_group(struct attribute_group *attrs); 277void spu_remove_dev_attr_group(struct attribute_group *attrs);
278 278
279int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea, 279int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
280 unsigned long dsisr, unsigned *flt); 280 unsigned long dsisr, unsigned *flt);
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 1e104af08483..c97185885c6d 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -3,7 +3,7 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5 5
6struct sys_device; 6struct device;
7struct device_node; 7struct device_node;
8 8
9#ifdef CONFIG_NUMA 9#ifdef CONFIG_NUMA
@@ -86,19 +86,19 @@ extern int __node_distance(int, int);
86 86
87extern void __init dump_numa_cpu_topology(void); 87extern void __init dump_numa_cpu_topology(void);
88 88
89extern int sysfs_add_device_to_node(struct sys_device *dev, int nid); 89extern int sysfs_add_device_to_node(struct device *dev, int nid);
90extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid); 90extern void sysfs_remove_device_from_node(struct device *dev, int nid);
91 91
92#else 92#else
93 93
94static inline void dump_numa_cpu_topology(void) {} 94static inline void dump_numa_cpu_topology(void) {}
95 95
96static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid) 96static inline int sysfs_add_device_to_node(struct device *dev, int nid)
97{ 97{
98 return 0; 98 return 0;
99} 99}
100 100
101static inline void sysfs_remove_device_from_node(struct sys_device *dev, 101static inline void sysfs_remove_device_from_node(struct device *dev,
102 int nid) 102 int nid)
103{ 103{
104} 104}
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index a3c684b4c862..92c6b008dd2b 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -451,15 +451,15 @@ out:
451static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id) 451static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id)
452{ 452{
453 struct cache_dir *cache_dir; 453 struct cache_dir *cache_dir;
454 struct sys_device *sysdev; 454 struct device *dev;
455 struct kobject *kobj = NULL; 455 struct kobject *kobj = NULL;
456 456
457 sysdev = get_cpu_sysdev(cpu_id); 457 dev = get_cpu_device(cpu_id);
458 WARN_ONCE(!sysdev, "no sysdev for CPU %i\n", cpu_id); 458 WARN_ONCE(!dev, "no dev for CPU %i\n", cpu_id);
459 if (!sysdev) 459 if (!dev)
460 goto err; 460 goto err;
461 461
462 kobj = kobject_create_and_add("cache", &sysdev->kobj); 462 kobj = kobject_create_and_add("cache", &dev->kobj);
463 if (!kobj) 463 if (!kobj)
464 goto err; 464 goto err;
465 465
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 6df70907d60a..d9a7a464ec51 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -27,7 +27,7 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/cache.h> 28#include <linux/cache.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/sysdev.h> 30#include <linux/device.h>
31#include <linux/cpu.h> 31#include <linux/cpu.h>
32#include <linux/notifier.h> 32#include <linux/notifier.h>
33#include <linux/topology.h> 33#include <linux/topology.h>
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index ce035c1905f0..5e7c1655f13a 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -1,4 +1,4 @@
1#include <linux/sysdev.h> 1#include <linux/device.h>
2#include <linux/cpu.h> 2#include <linux/cpu.h>
3#include <linux/smp.h> 3#include <linux/smp.h>
4#include <linux/percpu.h> 4#include <linux/percpu.h>
@@ -37,12 +37,12 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
37/* Time in microseconds we delay before sleeping in the idle loop */ 37/* Time in microseconds we delay before sleeping in the idle loop */
38DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; 38DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 };
39 39
40static ssize_t store_smt_snooze_delay(struct sys_device *dev, 40static ssize_t store_smt_snooze_delay(struct device *dev,
41 struct sysdev_attribute *attr, 41 struct device_attribute *attr,
42 const char *buf, 42 const char *buf,
43 size_t count) 43 size_t count)
44{ 44{
45 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 45 struct cpu *cpu = container_of(dev, struct cpu, dev);
46 ssize_t ret; 46 ssize_t ret;
47 long snooze; 47 long snooze;
48 48
@@ -50,21 +50,21 @@ static ssize_t store_smt_snooze_delay(struct sys_device *dev,
50 if (ret != 1) 50 if (ret != 1)
51 return -EINVAL; 51 return -EINVAL;
52 52
53 per_cpu(smt_snooze_delay, cpu->sysdev.id) = snooze; 53 per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
54 54
55 return count; 55 return count;
56} 56}
57 57
58static ssize_t show_smt_snooze_delay(struct sys_device *dev, 58static ssize_t show_smt_snooze_delay(struct device *dev,
59 struct sysdev_attribute *attr, 59 struct device_attribute *attr,
60 char *buf) 60 char *buf)
61{ 61{
62 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 62 struct cpu *cpu = container_of(dev, struct cpu, dev);
63 63
64 return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->sysdev.id)); 64 return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id));
65} 65}
66 66
67static SYSDEV_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, 67static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay,
68 store_smt_snooze_delay); 68 store_smt_snooze_delay);
69 69
70static int __init setup_smt_snooze_delay(char *str) 70static int __init setup_smt_snooze_delay(char *str)
@@ -117,25 +117,25 @@ static void write_##NAME(void *val) \
117 ppc_enable_pmcs(); \ 117 ppc_enable_pmcs(); \
118 mtspr(ADDRESS, *(unsigned long *)val); \ 118 mtspr(ADDRESS, *(unsigned long *)val); \
119} \ 119} \
120static ssize_t show_##NAME(struct sys_device *dev, \ 120static ssize_t show_##NAME(struct device *dev, \
121 struct sysdev_attribute *attr, \ 121 struct device_attribute *attr, \
122 char *buf) \ 122 char *buf) \
123{ \ 123{ \
124 struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ 124 struct cpu *cpu = container_of(dev, struct cpu, dev); \
125 unsigned long val; \ 125 unsigned long val; \
126 smp_call_function_single(cpu->sysdev.id, read_##NAME, &val, 1); \ 126 smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1); \
127 return sprintf(buf, "%lx\n", val); \ 127 return sprintf(buf, "%lx\n", val); \
128} \ 128} \
129static ssize_t __used \ 129static ssize_t __used \
130 store_##NAME(struct sys_device *dev, struct sysdev_attribute *attr, \ 130 store_##NAME(struct device *dev, struct device_attribute *attr, \
131 const char *buf, size_t count) \ 131 const char *buf, size_t count) \
132{ \ 132{ \
133 struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ 133 struct cpu *cpu = container_of(dev, struct cpu, dev); \
134 unsigned long val; \ 134 unsigned long val; \
135 int ret = sscanf(buf, "%lx", &val); \ 135 int ret = sscanf(buf, "%lx", &val); \
136 if (ret != 1) \ 136 if (ret != 1) \
137 return -EINVAL; \ 137 return -EINVAL; \
138 smp_call_function_single(cpu->sysdev.id, write_##NAME, &val, 1); \ 138 smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \
139 return count; \ 139 return count; \
140} 140}
141 141
@@ -178,22 +178,22 @@ SYSFS_PMCSETUP(purr, SPRN_PURR);
178SYSFS_PMCSETUP(spurr, SPRN_SPURR); 178SYSFS_PMCSETUP(spurr, SPRN_SPURR);
179SYSFS_PMCSETUP(dscr, SPRN_DSCR); 179SYSFS_PMCSETUP(dscr, SPRN_DSCR);
180 180
181static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 181static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
182static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); 182static DEVICE_ATTR(spurr, 0600, show_spurr, NULL);
183static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); 183static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr);
184static SYSDEV_ATTR(purr, 0600, show_purr, store_purr); 184static DEVICE_ATTR(purr, 0600, show_purr, store_purr);
185 185
186unsigned long dscr_default = 0; 186unsigned long dscr_default = 0;
187EXPORT_SYMBOL(dscr_default); 187EXPORT_SYMBOL(dscr_default);
188 188
189static ssize_t show_dscr_default(struct sysdev_class *class, 189static ssize_t show_dscr_default(struct device *dev,
190 struct sysdev_class_attribute *attr, char *buf) 190 struct device_attribute *attr, char *buf)
191{ 191{
192 return sprintf(buf, "%lx\n", dscr_default); 192 return sprintf(buf, "%lx\n", dscr_default);
193} 193}
194 194
195static ssize_t __used store_dscr_default(struct sysdev_class *class, 195static ssize_t __used store_dscr_default(struct device *dev,
196 struct sysdev_class_attribute *attr, const char *buf, 196 struct device_attribute *attr, const char *buf,
197 size_t count) 197 size_t count)
198{ 198{
199 unsigned long val; 199 unsigned long val;
@@ -207,15 +207,14 @@ static ssize_t __used store_dscr_default(struct sysdev_class *class,
207 return count; 207 return count;
208} 208}
209 209
210static SYSDEV_CLASS_ATTR(dscr_default, 0600, 210static DEVICE_ATTR(dscr_default, 0600,
211 show_dscr_default, store_dscr_default); 211 show_dscr_default, store_dscr_default);
212 212
213static void sysfs_create_dscr_default(void) 213static void sysfs_create_dscr_default(void)
214{ 214{
215 int err = 0; 215 int err = 0;
216 if (cpu_has_feature(CPU_FTR_DSCR)) 216 if (cpu_has_feature(CPU_FTR_DSCR))
217 err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 217 err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default);
218 &attr_dscr_default.attr);
219} 218}
220#endif /* CONFIG_PPC64 */ 219#endif /* CONFIG_PPC64 */
221 220
@@ -259,72 +258,72 @@ SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3);
259#endif /* HAS_PPC_PMC_PA6T */ 258#endif /* HAS_PPC_PMC_PA6T */
260 259
261#ifdef HAS_PPC_PMC_IBM 260#ifdef HAS_PPC_PMC_IBM
262static struct sysdev_attribute ibm_common_attrs[] = { 261static struct device_attribute ibm_common_attrs[] = {
263 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 262 __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
264 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 263 __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
265}; 264};
266#endif /* HAS_PPC_PMC_G4 */ 265#endif /* HAS_PPC_PMC_G4 */
267 266
268#ifdef HAS_PPC_PMC_G4 267#ifdef HAS_PPC_PMC_G4
269static struct sysdev_attribute g4_common_attrs[] = { 268static struct device_attribute g4_common_attrs[] = {
270 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 269 __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
271 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 270 __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
272 _SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), 271 __ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2),
273}; 272};
274#endif /* HAS_PPC_PMC_G4 */ 273#endif /* HAS_PPC_PMC_G4 */
275 274
276static struct sysdev_attribute classic_pmc_attrs[] = { 275static struct device_attribute classic_pmc_attrs[] = {
277 _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), 276 __ATTR(pmc1, 0600, show_pmc1, store_pmc1),
278 _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), 277 __ATTR(pmc2, 0600, show_pmc2, store_pmc2),
279 _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), 278 __ATTR(pmc3, 0600, show_pmc3, store_pmc3),
280 _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), 279 __ATTR(pmc4, 0600, show_pmc4, store_pmc4),
281 _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), 280 __ATTR(pmc5, 0600, show_pmc5, store_pmc5),
282 _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), 281 __ATTR(pmc6, 0600, show_pmc6, store_pmc6),
283#ifdef CONFIG_PPC64 282#ifdef CONFIG_PPC64
284 _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), 283 __ATTR(pmc7, 0600, show_pmc7, store_pmc7),
285 _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), 284 __ATTR(pmc8, 0600, show_pmc8, store_pmc8),
286#endif 285#endif
287}; 286};
288 287
289#ifdef HAS_PPC_PMC_PA6T 288#ifdef HAS_PPC_PMC_PA6T
290static struct sysdev_attribute pa6t_attrs[] = { 289static struct device_attribute pa6t_attrs[] = {
291 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 290 __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
292 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 291 __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
293 _SYSDEV_ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), 292 __ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0),
294 _SYSDEV_ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), 293 __ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1),
295 _SYSDEV_ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), 294 __ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2),
296 _SYSDEV_ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), 295 __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3),
297 _SYSDEV_ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), 296 __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4),
298 _SYSDEV_ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), 297 __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5),
299#ifdef CONFIG_DEBUG_KERNEL 298#ifdef CONFIG_DEBUG_KERNEL
300 _SYSDEV_ATTR(hid0, 0600, show_hid0, store_hid0), 299 __ATTR(hid0, 0600, show_hid0, store_hid0),
301 _SYSDEV_ATTR(hid1, 0600, show_hid1, store_hid1), 300 __ATTR(hid1, 0600, show_hid1, store_hid1),
302 _SYSDEV_ATTR(hid4, 0600, show_hid4, store_hid4), 301 __ATTR(hid4, 0600, show_hid4, store_hid4),
303 _SYSDEV_ATTR(hid5, 0600, show_hid5, store_hid5), 302 __ATTR(hid5, 0600, show_hid5, store_hid5),
304 _SYSDEV_ATTR(ima0, 0600, show_ima0, store_ima0), 303 __ATTR(ima0, 0600, show_ima0, store_ima0),
305 _SYSDEV_ATTR(ima1, 0600, show_ima1, store_ima1), 304 __ATTR(ima1, 0600, show_ima1, store_ima1),
306 _SYSDEV_ATTR(ima2, 0600, show_ima2, store_ima2), 305 __ATTR(ima2, 0600, show_ima2, store_ima2),
307 _SYSDEV_ATTR(ima3, 0600, show_ima3, store_ima3), 306 __ATTR(ima3, 0600, show_ima3, store_ima3),
308 _SYSDEV_ATTR(ima4, 0600, show_ima4, store_ima4), 307 __ATTR(ima4, 0600, show_ima4, store_ima4),
309 _SYSDEV_ATTR(ima5, 0600, show_ima5, store_ima5), 308 __ATTR(ima5, 0600, show_ima5, store_ima5),
310 _SYSDEV_ATTR(ima6, 0600, show_ima6, store_ima6), 309 __ATTR(ima6, 0600, show_ima6, store_ima6),
311 _SYSDEV_ATTR(ima7, 0600, show_ima7, store_ima7), 310 __ATTR(ima7, 0600, show_ima7, store_ima7),
312 _SYSDEV_ATTR(ima8, 0600, show_ima8, store_ima8), 311 __ATTR(ima8, 0600, show_ima8, store_ima8),
313 _SYSDEV_ATTR(ima9, 0600, show_ima9, store_ima9), 312 __ATTR(ima9, 0600, show_ima9, store_ima9),
314 _SYSDEV_ATTR(imaat, 0600, show_imaat, store_imaat), 313 __ATTR(imaat, 0600, show_imaat, store_imaat),
315 _SYSDEV_ATTR(btcr, 0600, show_btcr, store_btcr), 314 __ATTR(btcr, 0600, show_btcr, store_btcr),
316 _SYSDEV_ATTR(pccr, 0600, show_pccr, store_pccr), 315 __ATTR(pccr, 0600, show_pccr, store_pccr),
317 _SYSDEV_ATTR(rpccr, 0600, show_rpccr, store_rpccr), 316 __ATTR(rpccr, 0600, show_rpccr, store_rpccr),
318 _SYSDEV_ATTR(der, 0600, show_der, store_der), 317 __ATTR(der, 0600, show_der, store_der),
319 _SYSDEV_ATTR(mer, 0600, show_mer, store_mer), 318 __ATTR(mer, 0600, show_mer, store_mer),
320 _SYSDEV_ATTR(ber, 0600, show_ber, store_ber), 319 __ATTR(ber, 0600, show_ber, store_ber),
321 _SYSDEV_ATTR(ier, 0600, show_ier, store_ier), 320 __ATTR(ier, 0600, show_ier, store_ier),
322 _SYSDEV_ATTR(sier, 0600, show_sier, store_sier), 321 __ATTR(sier, 0600, show_sier, store_sier),
323 _SYSDEV_ATTR(siar, 0600, show_siar, store_siar), 322 __ATTR(siar, 0600, show_siar, store_siar),
324 _SYSDEV_ATTR(tsr0, 0600, show_tsr0, store_tsr0), 323 __ATTR(tsr0, 0600, show_tsr0, store_tsr0),
325 _SYSDEV_ATTR(tsr1, 0600, show_tsr1, store_tsr1), 324 __ATTR(tsr1, 0600, show_tsr1, store_tsr1),
326 _SYSDEV_ATTR(tsr2, 0600, show_tsr2, store_tsr2), 325 __ATTR(tsr2, 0600, show_tsr2, store_tsr2),
327 _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), 326 __ATTR(tsr3, 0600, show_tsr3, store_tsr3),
328#endif /* CONFIG_DEBUG_KERNEL */ 327#endif /* CONFIG_DEBUG_KERNEL */
329}; 328};
330#endif /* HAS_PPC_PMC_PA6T */ 329#endif /* HAS_PPC_PMC_PA6T */
@@ -333,14 +332,14 @@ static struct sysdev_attribute pa6t_attrs[] = {
333static void __cpuinit register_cpu_online(unsigned int cpu) 332static void __cpuinit register_cpu_online(unsigned int cpu)
334{ 333{
335 struct cpu *c = &per_cpu(cpu_devices, cpu); 334 struct cpu *c = &per_cpu(cpu_devices, cpu);
336 struct sys_device *s = &c->sysdev; 335 struct device *s = &c->dev;
337 struct sysdev_attribute *attrs, *pmc_attrs; 336 struct device_attribute *attrs, *pmc_attrs;
338 int i, nattrs; 337 int i, nattrs;
339 338
340#ifdef CONFIG_PPC64 339#ifdef CONFIG_PPC64
341 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 340 if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
342 cpu_has_feature(CPU_FTR_SMT)) 341 cpu_has_feature(CPU_FTR_SMT))
343 sysdev_create_file(s, &attr_smt_snooze_delay); 342 device_create_file(s, &dev_attr_smt_snooze_delay);
344#endif 343#endif
345 344
346 /* PMC stuff */ 345 /* PMC stuff */
@@ -348,14 +347,14 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
348#ifdef HAS_PPC_PMC_IBM 347#ifdef HAS_PPC_PMC_IBM
349 case PPC_PMC_IBM: 348 case PPC_PMC_IBM:
350 attrs = ibm_common_attrs; 349 attrs = ibm_common_attrs;
351 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 350 nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute);
352 pmc_attrs = classic_pmc_attrs; 351 pmc_attrs = classic_pmc_attrs;
353 break; 352 break;
354#endif /* HAS_PPC_PMC_IBM */ 353#endif /* HAS_PPC_PMC_IBM */
355#ifdef HAS_PPC_PMC_G4 354#ifdef HAS_PPC_PMC_G4
356 case PPC_PMC_G4: 355 case PPC_PMC_G4:
357 attrs = g4_common_attrs; 356 attrs = g4_common_attrs;
358 nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); 357 nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute);
359 pmc_attrs = classic_pmc_attrs; 358 pmc_attrs = classic_pmc_attrs;
360 break; 359 break;
361#endif /* HAS_PPC_PMC_G4 */ 360#endif /* HAS_PPC_PMC_G4 */
@@ -363,7 +362,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
363 case PPC_PMC_PA6T: 362 case PPC_PMC_PA6T:
364 /* PA Semi starts counting at PMC0 */ 363 /* PA Semi starts counting at PMC0 */
365 attrs = pa6t_attrs; 364 attrs = pa6t_attrs;
366 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 365 nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute);
367 pmc_attrs = NULL; 366 pmc_attrs = NULL;
368 break; 367 break;
369#endif /* HAS_PPC_PMC_PA6T */ 368#endif /* HAS_PPC_PMC_PA6T */
@@ -374,24 +373,24 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
374 } 373 }
375 374
376 for (i = 0; i < nattrs; i++) 375 for (i = 0; i < nattrs; i++)
377 sysdev_create_file(s, &attrs[i]); 376 device_create_file(s, &attrs[i]);
378 377
379 if (pmc_attrs) 378 if (pmc_attrs)
380 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 379 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
381 sysdev_create_file(s, &pmc_attrs[i]); 380 device_create_file(s, &pmc_attrs[i]);
382 381
383#ifdef CONFIG_PPC64 382#ifdef CONFIG_PPC64
384 if (cpu_has_feature(CPU_FTR_MMCRA)) 383 if (cpu_has_feature(CPU_FTR_MMCRA))
385 sysdev_create_file(s, &attr_mmcra); 384 device_create_file(s, &dev_attr_mmcra);
386 385
387 if (cpu_has_feature(CPU_FTR_PURR)) 386 if (cpu_has_feature(CPU_FTR_PURR))
388 sysdev_create_file(s, &attr_purr); 387 device_create_file(s, &dev_attr_purr);
389 388
390 if (cpu_has_feature(CPU_FTR_SPURR)) 389 if (cpu_has_feature(CPU_FTR_SPURR))
391 sysdev_create_file(s, &attr_spurr); 390 device_create_file(s, &dev_attr_spurr);
392 391
393 if (cpu_has_feature(CPU_FTR_DSCR)) 392 if (cpu_has_feature(CPU_FTR_DSCR))
394 sysdev_create_file(s, &attr_dscr); 393 device_create_file(s, &dev_attr_dscr);
395#endif /* CONFIG_PPC64 */ 394#endif /* CONFIG_PPC64 */
396 395
397 cacheinfo_cpu_online(cpu); 396 cacheinfo_cpu_online(cpu);
@@ -401,8 +400,8 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
401static void unregister_cpu_online(unsigned int cpu) 400static void unregister_cpu_online(unsigned int cpu)
402{ 401{
403 struct cpu *c = &per_cpu(cpu_devices, cpu); 402 struct cpu *c = &per_cpu(cpu_devices, cpu);
404 struct sys_device *s = &c->sysdev; 403 struct device *s = &c->dev;
405 struct sysdev_attribute *attrs, *pmc_attrs; 404 struct device_attribute *attrs, *pmc_attrs;
406 int i, nattrs; 405 int i, nattrs;
407 406
408 BUG_ON(!c->hotpluggable); 407 BUG_ON(!c->hotpluggable);
@@ -410,7 +409,7 @@ static void unregister_cpu_online(unsigned int cpu)
410#ifdef CONFIG_PPC64 409#ifdef CONFIG_PPC64
411 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 410 if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
412 cpu_has_feature(CPU_FTR_SMT)) 411 cpu_has_feature(CPU_FTR_SMT))
413 sysdev_remove_file(s, &attr_smt_snooze_delay); 412 device_remove_file(s, &dev_attr_smt_snooze_delay);
414#endif 413#endif
415 414
416 /* PMC stuff */ 415 /* PMC stuff */
@@ -418,14 +417,14 @@ static void unregister_cpu_online(unsigned int cpu)
418#ifdef HAS_PPC_PMC_IBM 417#ifdef HAS_PPC_PMC_IBM
419 case PPC_PMC_IBM: 418 case PPC_PMC_IBM:
420 attrs = ibm_common_attrs; 419 attrs = ibm_common_attrs;
421 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 420 nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute);
422 pmc_attrs = classic_pmc_attrs; 421 pmc_attrs = classic_pmc_attrs;
423 break; 422 break;
424#endif /* HAS_PPC_PMC_IBM */ 423#endif /* HAS_PPC_PMC_IBM */
425#ifdef HAS_PPC_PMC_G4 424#ifdef HAS_PPC_PMC_G4
426 case PPC_PMC_G4: 425 case PPC_PMC_G4:
427 attrs = g4_common_attrs; 426 attrs = g4_common_attrs;
428 nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); 427 nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute);
429 pmc_attrs = classic_pmc_attrs; 428 pmc_attrs = classic_pmc_attrs;
430 break; 429 break;
431#endif /* HAS_PPC_PMC_G4 */ 430#endif /* HAS_PPC_PMC_G4 */
@@ -433,7 +432,7 @@ static void unregister_cpu_online(unsigned int cpu)
433 case PPC_PMC_PA6T: 432 case PPC_PMC_PA6T:
434 /* PA Semi starts counting at PMC0 */ 433 /* PA Semi starts counting at PMC0 */
435 attrs = pa6t_attrs; 434 attrs = pa6t_attrs;
436 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 435 nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute);
437 pmc_attrs = NULL; 436 pmc_attrs = NULL;
438 break; 437 break;
439#endif /* HAS_PPC_PMC_PA6T */ 438#endif /* HAS_PPC_PMC_PA6T */
@@ -444,24 +443,24 @@ static void unregister_cpu_online(unsigned int cpu)
444 } 443 }
445 444
446 for (i = 0; i < nattrs; i++) 445 for (i = 0; i < nattrs; i++)
447 sysdev_remove_file(s, &attrs[i]); 446 device_remove_file(s, &attrs[i]);
448 447
449 if (pmc_attrs) 448 if (pmc_attrs)
450 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 449 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
451 sysdev_remove_file(s, &pmc_attrs[i]); 450 device_remove_file(s, &pmc_attrs[i]);
452 451
453#ifdef CONFIG_PPC64 452#ifdef CONFIG_PPC64
454 if (cpu_has_feature(CPU_FTR_MMCRA)) 453 if (cpu_has_feature(CPU_FTR_MMCRA))
455 sysdev_remove_file(s, &attr_mmcra); 454 device_remove_file(s, &dev_attr_mmcra);
456 455
457 if (cpu_has_feature(CPU_FTR_PURR)) 456 if (cpu_has_feature(CPU_FTR_PURR))
458 sysdev_remove_file(s, &attr_purr); 457 device_remove_file(s, &dev_attr_purr);
459 458
460 if (cpu_has_feature(CPU_FTR_SPURR)) 459 if (cpu_has_feature(CPU_FTR_SPURR))
461 sysdev_remove_file(s, &attr_spurr); 460 device_remove_file(s, &dev_attr_spurr);
462 461
463 if (cpu_has_feature(CPU_FTR_DSCR)) 462 if (cpu_has_feature(CPU_FTR_DSCR))
464 sysdev_remove_file(s, &attr_dscr); 463 device_remove_file(s, &dev_attr_dscr);
465#endif /* CONFIG_PPC64 */ 464#endif /* CONFIG_PPC64 */
466 465
467 cacheinfo_cpu_offline(cpu); 466 cacheinfo_cpu_offline(cpu);
@@ -513,70 +512,70 @@ static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
513 512
514static DEFINE_MUTEX(cpu_mutex); 513static DEFINE_MUTEX(cpu_mutex);
515 514
516int cpu_add_sysdev_attr(struct sysdev_attribute *attr) 515int cpu_add_dev_attr(struct device_attribute *attr)
517{ 516{
518 int cpu; 517 int cpu;
519 518
520 mutex_lock(&cpu_mutex); 519 mutex_lock(&cpu_mutex);
521 520
522 for_each_possible_cpu(cpu) { 521 for_each_possible_cpu(cpu) {
523 sysdev_create_file(get_cpu_sysdev(cpu), attr); 522 device_create_file(get_cpu_device(cpu), attr);
524 } 523 }
525 524
526 mutex_unlock(&cpu_mutex); 525 mutex_unlock(&cpu_mutex);
527 return 0; 526 return 0;
528} 527}
529EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr); 528EXPORT_SYMBOL_GPL(cpu_add_dev_attr);
530 529
531int cpu_add_sysdev_attr_group(struct attribute_group *attrs) 530int cpu_add_dev_attr_group(struct attribute_group *attrs)
532{ 531{
533 int cpu; 532 int cpu;
534 struct sys_device *sysdev; 533 struct device *dev;
535 int ret; 534 int ret;
536 535
537 mutex_lock(&cpu_mutex); 536 mutex_lock(&cpu_mutex);
538 537
539 for_each_possible_cpu(cpu) { 538 for_each_possible_cpu(cpu) {
540 sysdev = get_cpu_sysdev(cpu); 539 dev = get_cpu_device(cpu);
541 ret = sysfs_create_group(&sysdev->kobj, attrs); 540 ret = sysfs_create_group(&dev->kobj, attrs);
542 WARN_ON(ret != 0); 541 WARN_ON(ret != 0);
543 } 542 }
544 543
545 mutex_unlock(&cpu_mutex); 544 mutex_unlock(&cpu_mutex);
546 return 0; 545 return 0;
547} 546}
548EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group); 547EXPORT_SYMBOL_GPL(cpu_add_dev_attr_group);
549 548
550 549
551void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) 550void cpu_remove_dev_attr(struct device_attribute *attr)
552{ 551{
553 int cpu; 552 int cpu;
554 553
555 mutex_lock(&cpu_mutex); 554 mutex_lock(&cpu_mutex);
556 555
557 for_each_possible_cpu(cpu) { 556 for_each_possible_cpu(cpu) {
558 sysdev_remove_file(get_cpu_sysdev(cpu), attr); 557 device_remove_file(get_cpu_device(cpu), attr);
559 } 558 }
560 559
561 mutex_unlock(&cpu_mutex); 560 mutex_unlock(&cpu_mutex);
562} 561}
563EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr); 562EXPORT_SYMBOL_GPL(cpu_remove_dev_attr);
564 563
565void cpu_remove_sysdev_attr_group(struct attribute_group *attrs) 564void cpu_remove_dev_attr_group(struct attribute_group *attrs)
566{ 565{
567 int cpu; 566 int cpu;
568 struct sys_device *sysdev; 567 struct device *dev;
569 568
570 mutex_lock(&cpu_mutex); 569 mutex_lock(&cpu_mutex);
571 570
572 for_each_possible_cpu(cpu) { 571 for_each_possible_cpu(cpu) {
573 sysdev = get_cpu_sysdev(cpu); 572 dev = get_cpu_device(cpu);
574 sysfs_remove_group(&sysdev->kobj, attrs); 573 sysfs_remove_group(&dev->kobj, attrs);
575 } 574 }
576 575
577 mutex_unlock(&cpu_mutex); 576 mutex_unlock(&cpu_mutex);
578} 577}
579EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr_group); 578EXPORT_SYMBOL_GPL(cpu_remove_dev_attr_group);
580 579
581 580
582/* NUMA stuff */ 581/* NUMA stuff */
@@ -590,18 +589,18 @@ static void register_nodes(void)
590 register_one_node(i); 589 register_one_node(i);
591} 590}
592 591
593int sysfs_add_device_to_node(struct sys_device *dev, int nid) 592int sysfs_add_device_to_node(struct device *dev, int nid)
594{ 593{
595 struct node *node = &node_devices[nid]; 594 struct node *node = &node_devices[nid];
596 return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, 595 return sysfs_create_link(&node->dev.kobj, &dev->kobj,
597 kobject_name(&dev->kobj)); 596 kobject_name(&dev->kobj));
598} 597}
599EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); 598EXPORT_SYMBOL_GPL(sysfs_add_device_to_node);
600 599
601void sysfs_remove_device_from_node(struct sys_device *dev, int nid) 600void sysfs_remove_device_from_node(struct device *dev, int nid)
602{ 601{
603 struct node *node = &node_devices[nid]; 602 struct node *node = &node_devices[nid];
604 sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); 603 sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj));
605} 604}
606EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); 605EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node);
607 606
@@ -614,14 +613,14 @@ static void register_nodes(void)
614#endif 613#endif
615 614
616/* Only valid if CPU is present. */ 615/* Only valid if CPU is present. */
617static ssize_t show_physical_id(struct sys_device *dev, 616static ssize_t show_physical_id(struct device *dev,
618 struct sysdev_attribute *attr, char *buf) 617 struct device_attribute *attr, char *buf)
619{ 618{
620 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 619 struct cpu *cpu = container_of(dev, struct cpu, dev);
621 620
622 return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->sysdev.id)); 621 return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->dev.id));
623} 622}
624static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); 623static DEVICE_ATTR(physical_id, 0444, show_physical_id, NULL);
625 624
626static int __init topology_init(void) 625static int __init topology_init(void)
627{ 626{
@@ -646,7 +645,7 @@ static int __init topology_init(void)
646 if (cpu_online(cpu) || c->hotpluggable) { 645 if (cpu_online(cpu) || c->hotpluggable) {
647 register_cpu(c, cpu); 646 register_cpu(c, cpu);
648 647
649 sysdev_create_file(&c->sysdev, &attr_physical_id); 648 device_create_file(&c->dev, &dev_attr_physical_id);
650 } 649 }
651 650
652 if (cpu_online(cpu)) 651 if (cpu_online(cpu))
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b22a83a91cb8..b088e985bee2 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1462,7 +1462,7 @@ int arch_update_cpu_topology(void)
1462{ 1462{
1463 int cpu, nid, old_nid; 1463 int cpu, nid, old_nid;
1464 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; 1464 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
1465 struct sys_device *sysdev; 1465 struct device *dev;
1466 1466
1467 for_each_cpu(cpu,&cpu_associativity_changes_mask) { 1467 for_each_cpu(cpu,&cpu_associativity_changes_mask) {
1468 vphn_get_associativity(cpu, associativity); 1468 vphn_get_associativity(cpu, associativity);
@@ -1483,9 +1483,9 @@ int arch_update_cpu_topology(void)
1483 register_cpu_under_node(cpu, nid); 1483 register_cpu_under_node(cpu, nid);
1484 put_online_cpus(); 1484 put_online_cpus();
1485 1485
1486 sysdev = get_cpu_sysdev(cpu); 1486 dev = get_cpu_device(cpu);
1487 if (sysdev) 1487 if (dev)
1488 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 1488 kobject_uevent(&dev->kobj, KOBJ_CHANGE);
1489 } 1489 }
1490 1490
1491 return 1; 1491 return 1;
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c
index 4d4c8c169124..94560db788bf 100644
--- a/arch/powerpc/platforms/cell/cbe_thermal.c
+++ b/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -46,7 +46,7 @@
46 */ 46 */
47 47
48#include <linux/module.h> 48#include <linux/module.h>
49#include <linux/sysdev.h> 49#include <linux/device.h>
50#include <linux/kernel.h> 50#include <linux/kernel.h>
51#include <linux/cpu.h> 51#include <linux/cpu.h>
52#include <asm/spu.h> 52#include <asm/spu.h>
@@ -59,8 +59,8 @@
59#define TEMP_MIN 65 59#define TEMP_MIN 65
60#define TEMP_MAX 125 60#define TEMP_MAX 125
61 61
62#define SYSDEV_PREFIX_ATTR(_prefix,_name,_mode) \ 62#define DEVICE_PREFIX_ATTR(_prefix,_name,_mode) \
63struct sysdev_attribute attr_ ## _prefix ## _ ## _name = { \ 63struct device_attribute attr_ ## _prefix ## _ ## _name = { \
64 .attr = { .name = __stringify(_name), .mode = _mode }, \ 64 .attr = { .name = __stringify(_name), .mode = _mode }, \
65 .show = _prefix ## _show_ ## _name, \ 65 .show = _prefix ## _show_ ## _name, \
66 .store = _prefix ## _store_ ## _name, \ 66 .store = _prefix ## _store_ ## _name, \
@@ -76,36 +76,36 @@ static inline u8 temp_to_reg(u8 temp)
76 return ((temp - TEMP_MIN) >> 1) & 0x3f; 76 return ((temp - TEMP_MIN) >> 1) & 0x3f;
77} 77}
78 78
79static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) 79static struct cbe_pmd_regs __iomem *get_pmd_regs(struct device *dev)
80{ 80{
81 struct spu *spu; 81 struct spu *spu;
82 82
83 spu = container_of(sysdev, struct spu, sysdev); 83 spu = container_of(dev, struct spu, dev);
84 84
85 return cbe_get_pmd_regs(spu_devnode(spu)); 85 return cbe_get_pmd_regs(spu_devnode(spu));
86} 86}
87 87
88/* returns the value for a given spu in a given register */ 88/* returns the value for a given spu in a given register */
89static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg) 89static u8 spu_read_register_value(struct device *dev, union spe_reg __iomem *reg)
90{ 90{
91 union spe_reg value; 91 union spe_reg value;
92 struct spu *spu; 92 struct spu *spu;
93 93
94 spu = container_of(sysdev, struct spu, sysdev); 94 spu = container_of(dev, struct spu, dev);
95 value.val = in_be64(&reg->val); 95 value.val = in_be64(&reg->val);
96 96
97 return value.spe[spu->spe_id]; 97 return value.spe[spu->spe_id];
98} 98}
99 99
100static ssize_t spu_show_temp(struct sys_device *sysdev, struct sysdev_attribute *attr, 100static ssize_t spu_show_temp(struct device *dev, struct device_attribute *attr,
101 char *buf) 101 char *buf)
102{ 102{
103 u8 value; 103 u8 value;
104 struct cbe_pmd_regs __iomem *pmd_regs; 104 struct cbe_pmd_regs __iomem *pmd_regs;
105 105
106 pmd_regs = get_pmd_regs(sysdev); 106 pmd_regs = get_pmd_regs(dev);
107 107
108 value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1); 108 value = spu_read_register_value(dev, &pmd_regs->ts_ctsr1);
109 109
110 return sprintf(buf, "%d\n", reg_to_temp(value)); 110 return sprintf(buf, "%d\n", reg_to_temp(value));
111} 111}
@@ -147,48 +147,48 @@ static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char
147 return size; 147 return size;
148} 148}
149 149
150static ssize_t spu_show_throttle_end(struct sys_device *sysdev, 150static ssize_t spu_show_throttle_end(struct device *dev,
151 struct sysdev_attribute *attr, char *buf) 151 struct device_attribute *attr, char *buf)
152{ 152{
153 return show_throttle(get_pmd_regs(sysdev), buf, 0); 153 return show_throttle(get_pmd_regs(dev), buf, 0);
154} 154}
155 155
156static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, 156static ssize_t spu_show_throttle_begin(struct device *dev,
157 struct sysdev_attribute *attr, char *buf) 157 struct device_attribute *attr, char *buf)
158{ 158{
159 return show_throttle(get_pmd_regs(sysdev), buf, 8); 159 return show_throttle(get_pmd_regs(dev), buf, 8);
160} 160}
161 161
162static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, 162static ssize_t spu_show_throttle_full_stop(struct device *dev,
163 struct sysdev_attribute *attr, char *buf) 163 struct device_attribute *attr, char *buf)
164{ 164{
165 return show_throttle(get_pmd_regs(sysdev), buf, 16); 165 return show_throttle(get_pmd_regs(dev), buf, 16);
166} 166}
167 167
168static ssize_t spu_store_throttle_end(struct sys_device *sysdev, 168static ssize_t spu_store_throttle_end(struct device *dev,
169 struct sysdev_attribute *attr, const char *buf, size_t size) 169 struct device_attribute *attr, const char *buf, size_t size)
170{ 170{
171 return store_throttle(get_pmd_regs(sysdev), buf, size, 0); 171 return store_throttle(get_pmd_regs(dev), buf, size, 0);
172} 172}
173 173
174static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, 174static ssize_t spu_store_throttle_begin(struct device *dev,
175 struct sysdev_attribute *attr, const char *buf, size_t size) 175 struct device_attribute *attr, const char *buf, size_t size)
176{ 176{
177 return store_throttle(get_pmd_regs(sysdev), buf, size, 8); 177 return store_throttle(get_pmd_regs(dev), buf, size, 8);
178} 178}
179 179
180static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, 180static ssize_t spu_store_throttle_full_stop(struct device *dev,
181 struct sysdev_attribute *attr, const char *buf, size_t size) 181 struct device_attribute *attr, const char *buf, size_t size)
182{ 182{
183 return store_throttle(get_pmd_regs(sysdev), buf, size, 16); 183 return store_throttle(get_pmd_regs(dev), buf, size, 16);
184} 184}
185 185
186static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) 186static ssize_t ppe_show_temp(struct device *dev, char *buf, int pos)
187{ 187{
188 struct cbe_pmd_regs __iomem *pmd_regs; 188 struct cbe_pmd_regs __iomem *pmd_regs;
189 u64 value; 189 u64 value;
190 190
191 pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); 191 pmd_regs = cbe_get_cpu_pmd_regs(dev->id);
192 value = in_be64(&pmd_regs->ts_ctsr2); 192 value = in_be64(&pmd_regs->ts_ctsr2);
193 193
194 value = (value >> pos) & 0x3f; 194 value = (value >> pos) & 0x3f;
@@ -199,64 +199,64 @@ static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos)
199 199
200/* shows the temperature of the DTS on the PPE, 200/* shows the temperature of the DTS on the PPE,
201 * located near the linear thermal sensor */ 201 * located near the linear thermal sensor */
202static ssize_t ppe_show_temp0(struct sys_device *sysdev, 202static ssize_t ppe_show_temp0(struct device *dev,
203 struct sysdev_attribute *attr, char *buf) 203 struct device_attribute *attr, char *buf)
204{ 204{
205 return ppe_show_temp(sysdev, buf, 32); 205 return ppe_show_temp(dev, buf, 32);
206} 206}
207 207
208/* shows the temperature of the second DTS on the PPE */ 208/* shows the temperature of the second DTS on the PPE */
209static ssize_t ppe_show_temp1(struct sys_device *sysdev, 209static ssize_t ppe_show_temp1(struct device *dev,
210 struct sysdev_attribute *attr, char *buf) 210 struct device_attribute *attr, char *buf)
211{ 211{
212 return ppe_show_temp(sysdev, buf, 0); 212 return ppe_show_temp(dev, buf, 0);
213} 213}
214 214
215static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, 215static ssize_t ppe_show_throttle_end(struct device *dev,
216 struct sysdev_attribute *attr, char *buf) 216 struct device_attribute *attr, char *buf)
217{ 217{
218 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); 218 return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 32);
219} 219}
220 220
221static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, 221static ssize_t ppe_show_throttle_begin(struct device *dev,
222 struct sysdev_attribute *attr, char *buf) 222 struct device_attribute *attr, char *buf)
223{ 223{
224 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); 224 return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 40);
225} 225}
226 226
227static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, 227static ssize_t ppe_show_throttle_full_stop(struct device *dev,
228 struct sysdev_attribute *attr, char *buf) 228 struct device_attribute *attr, char *buf)
229{ 229{
230 return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); 230 return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 48);
231} 231}
232 232
233static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, 233static ssize_t ppe_store_throttle_end(struct device *dev,
234 struct sysdev_attribute *attr, const char *buf, size_t size) 234 struct device_attribute *attr, const char *buf, size_t size)
235{ 235{
236 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); 236 return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 32);
237} 237}
238 238
239static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, 239static ssize_t ppe_store_throttle_begin(struct device *dev,
240 struct sysdev_attribute *attr, const char *buf, size_t size) 240 struct device_attribute *attr, const char *buf, size_t size)
241{ 241{
242 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); 242 return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 40);
243} 243}
244 244
245static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, 245static ssize_t ppe_store_throttle_full_stop(struct device *dev,
246 struct sysdev_attribute *attr, const char *buf, size_t size) 246 struct device_attribute *attr, const char *buf, size_t size)
247{ 247{
248 return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); 248 return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 48);
249} 249}
250 250
251 251
252static struct sysdev_attribute attr_spu_temperature = { 252static struct device_attribute attr_spu_temperature = {
253 .attr = {.name = "temperature", .mode = 0400 }, 253 .attr = {.name = "temperature", .mode = 0400 },
254 .show = spu_show_temp, 254 .show = spu_show_temp,
255}; 255};
256 256
257static SYSDEV_PREFIX_ATTR(spu, throttle_end, 0600); 257static DEVICE_PREFIX_ATTR(spu, throttle_end, 0600);
258static SYSDEV_PREFIX_ATTR(spu, throttle_begin, 0600); 258static DEVICE_PREFIX_ATTR(spu, throttle_begin, 0600);
259static SYSDEV_PREFIX_ATTR(spu, throttle_full_stop, 0600); 259static DEVICE_PREFIX_ATTR(spu, throttle_full_stop, 0600);
260 260
261 261
262static struct attribute *spu_attributes[] = { 262static struct attribute *spu_attributes[] = {
@@ -272,19 +272,19 @@ static struct attribute_group spu_attribute_group = {
272 .attrs = spu_attributes, 272 .attrs = spu_attributes,
273}; 273};
274 274
275static struct sysdev_attribute attr_ppe_temperature0 = { 275static struct device_attribute attr_ppe_temperature0 = {
276 .attr = {.name = "temperature0", .mode = 0400 }, 276 .attr = {.name = "temperature0", .mode = 0400 },
277 .show = ppe_show_temp0, 277 .show = ppe_show_temp0,
278}; 278};
279 279
280static struct sysdev_attribute attr_ppe_temperature1 = { 280static struct device_attribute attr_ppe_temperature1 = {
281 .attr = {.name = "temperature1", .mode = 0400 }, 281 .attr = {.name = "temperature1", .mode = 0400 },
282 .show = ppe_show_temp1, 282 .show = ppe_show_temp1,
283}; 283};
284 284
285static SYSDEV_PREFIX_ATTR(ppe, throttle_end, 0600); 285static DEVICE_PREFIX_ATTR(ppe, throttle_end, 0600);
286static SYSDEV_PREFIX_ATTR(ppe, throttle_begin, 0600); 286static DEVICE_PREFIX_ATTR(ppe, throttle_begin, 0600);
287static SYSDEV_PREFIX_ATTR(ppe, throttle_full_stop, 0600); 287static DEVICE_PREFIX_ATTR(ppe, throttle_full_stop, 0600);
288 288
289static struct attribute *ppe_attributes[] = { 289static struct attribute *ppe_attributes[] = {
290 &attr_ppe_temperature0.attr, 290 &attr_ppe_temperature0.attr,
@@ -307,7 +307,7 @@ static int __init init_default_values(void)
307{ 307{
308 int cpu; 308 int cpu;
309 struct cbe_pmd_regs __iomem *pmd_regs; 309 struct cbe_pmd_regs __iomem *pmd_regs;
310 struct sys_device *sysdev; 310 struct device *dev;
311 union ppe_spe_reg tpr; 311 union ppe_spe_reg tpr;
312 union spe_reg str1; 312 union spe_reg str1;
313 u64 str2; 313 u64 str2;
@@ -349,14 +349,14 @@ static int __init init_default_values(void)
349 349
350 for_each_possible_cpu (cpu) { 350 for_each_possible_cpu (cpu) {
351 pr_debug("processing cpu %d\n", cpu); 351 pr_debug("processing cpu %d\n", cpu);
352 sysdev = get_cpu_sysdev(cpu); 352 dev = get_cpu_device(cpu);
353 353
354 if (!sysdev) { 354 if (!dev) {
355 pr_info("invalid sysdev pointer for cbe_thermal\n"); 355 pr_info("invalid dev pointer for cbe_thermal\n");
356 return -EINVAL; 356 return -EINVAL;
357 } 357 }
358 358
359 pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); 359 pmd_regs = cbe_get_cpu_pmd_regs(dev->id);
360 360
361 if (!pmd_regs) { 361 if (!pmd_regs) {
362 pr_info("invalid CBE regs pointer for cbe_thermal\n"); 362 pr_info("invalid CBE regs pointer for cbe_thermal\n");
@@ -379,8 +379,8 @@ static int __init thermal_init(void)
379 int rc = init_default_values(); 379 int rc = init_default_values();
380 380
381 if (rc == 0) { 381 if (rc == 0) {
382 spu_add_sysdev_attr_group(&spu_attribute_group); 382 spu_add_dev_attr_group(&spu_attribute_group);
383 cpu_add_sysdev_attr_group(&ppe_attribute_group); 383 cpu_add_dev_attr_group(&ppe_attribute_group);
384 } 384 }
385 385
386 return rc; 386 return rc;
@@ -389,8 +389,8 @@ module_init(thermal_init);
389 389
390static void __exit thermal_exit(void) 390static void __exit thermal_exit(void)
391{ 391{
392 spu_remove_sysdev_attr_group(&spu_attribute_group); 392 spu_remove_dev_attr_group(&spu_attribute_group);
393 cpu_remove_sysdev_attr_group(&ppe_attribute_group); 393 cpu_remove_dev_attr_group(&ppe_attribute_group);
394} 394}
395module_exit(thermal_exit); 395module_exit(thermal_exit);
396 396
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index f5c5c762d5a3..4a255cf8cd17 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -23,7 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/cache.h> 24#include <linux/cache.h>
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/cpu.h> 27#include <linux/cpu.h>
28 28
29#include <asm/ptrace.h> 29#include <asm/ptrace.h>
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index e94d3ecdd8bb..8b1213993b10 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -519,31 +519,32 @@ void spu_init_channels(struct spu *spu)
519} 519}
520EXPORT_SYMBOL_GPL(spu_init_channels); 520EXPORT_SYMBOL_GPL(spu_init_channels);
521 521
522static struct sysdev_class spu_sysdev_class = { 522static struct bus_type spu_subsys = {
523 .name = "spu", 523 .name = "spu",
524 .dev_name = "spu",
524}; 525};
525 526
526int spu_add_sysdev_attr(struct sysdev_attribute *attr) 527int spu_add_dev_attr(struct device_attribute *attr)
527{ 528{
528 struct spu *spu; 529 struct spu *spu;
529 530
530 mutex_lock(&spu_full_list_mutex); 531 mutex_lock(&spu_full_list_mutex);
531 list_for_each_entry(spu, &spu_full_list, full_list) 532 list_for_each_entry(spu, &spu_full_list, full_list)
532 sysdev_create_file(&spu->sysdev, attr); 533 device_create_file(&spu->dev, attr);
533 mutex_unlock(&spu_full_list_mutex); 534 mutex_unlock(&spu_full_list_mutex);
534 535
535 return 0; 536 return 0;
536} 537}
537EXPORT_SYMBOL_GPL(spu_add_sysdev_attr); 538EXPORT_SYMBOL_GPL(spu_add_dev_attr);
538 539
539int spu_add_sysdev_attr_group(struct attribute_group *attrs) 540int spu_add_dev_attr_group(struct attribute_group *attrs)
540{ 541{
541 struct spu *spu; 542 struct spu *spu;
542 int rc = 0; 543 int rc = 0;
543 544
544 mutex_lock(&spu_full_list_mutex); 545 mutex_lock(&spu_full_list_mutex);
545 list_for_each_entry(spu, &spu_full_list, full_list) { 546 list_for_each_entry(spu, &spu_full_list, full_list) {
546 rc = sysfs_create_group(&spu->sysdev.kobj, attrs); 547 rc = sysfs_create_group(&spu->dev.kobj, attrs);
547 548
548 /* we're in trouble here, but try unwinding anyway */ 549 /* we're in trouble here, but try unwinding anyway */
549 if (rc) { 550 if (rc) {
@@ -552,7 +553,7 @@ int spu_add_sysdev_attr_group(struct attribute_group *attrs)
552 553
553 list_for_each_entry_continue_reverse(spu, 554 list_for_each_entry_continue_reverse(spu,
554 &spu_full_list, full_list) 555 &spu_full_list, full_list)
555 sysfs_remove_group(&spu->sysdev.kobj, attrs); 556 sysfs_remove_group(&spu->dev.kobj, attrs);
556 break; 557 break;
557 } 558 }
558 } 559 }
@@ -561,45 +562,45 @@ int spu_add_sysdev_attr_group(struct attribute_group *attrs)
561 562
562 return rc; 563 return rc;
563} 564}
564EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group); 565EXPORT_SYMBOL_GPL(spu_add_dev_attr_group);
565 566
566 567
567void spu_remove_sysdev_attr(struct sysdev_attribute *attr) 568void spu_remove_dev_attr(struct device_attribute *attr)
568{ 569{
569 struct spu *spu; 570 struct spu *spu;
570 571
571 mutex_lock(&spu_full_list_mutex); 572 mutex_lock(&spu_full_list_mutex);
572 list_for_each_entry(spu, &spu_full_list, full_list) 573 list_for_each_entry(spu, &spu_full_list, full_list)
573 sysdev_remove_file(&spu->sysdev, attr); 574 device_remove_file(&spu->dev, attr);
574 mutex_unlock(&spu_full_list_mutex); 575 mutex_unlock(&spu_full_list_mutex);
575} 576}
576EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr); 577EXPORT_SYMBOL_GPL(spu_remove_dev_attr);
577 578
578void spu_remove_sysdev_attr_group(struct attribute_group *attrs) 579void spu_remove_dev_attr_group(struct attribute_group *attrs)
579{ 580{
580 struct spu *spu; 581 struct spu *spu;
581 582
582 mutex_lock(&spu_full_list_mutex); 583 mutex_lock(&spu_full_list_mutex);
583 list_for_each_entry(spu, &spu_full_list, full_list) 584 list_for_each_entry(spu, &spu_full_list, full_list)
584 sysfs_remove_group(&spu->sysdev.kobj, attrs); 585 sysfs_remove_group(&spu->dev.kobj, attrs);
585 mutex_unlock(&spu_full_list_mutex); 586 mutex_unlock(&spu_full_list_mutex);
586} 587}
587EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr_group); 588EXPORT_SYMBOL_GPL(spu_remove_dev_attr_group);
588 589
589static int spu_create_sysdev(struct spu *spu) 590static int spu_create_dev(struct spu *spu)
590{ 591{
591 int ret; 592 int ret;
592 593
593 spu->sysdev.id = spu->number; 594 spu->dev.id = spu->number;
594 spu->sysdev.cls = &spu_sysdev_class; 595 spu->dev.bus = &spu_subsys;
595 ret = sysdev_register(&spu->sysdev); 596 ret = device_register(&spu->dev);
596 if (ret) { 597 if (ret) {
597 printk(KERN_ERR "Can't register SPU %d with sysfs\n", 598 printk(KERN_ERR "Can't register SPU %d with sysfs\n",
598 spu->number); 599 spu->number);
599 return ret; 600 return ret;
600 } 601 }
601 602
602 sysfs_add_device_to_node(&spu->sysdev, spu->node); 603 sysfs_add_device_to_node(&spu->dev, spu->node);
603 604
604 return 0; 605 return 0;
605} 606}
@@ -635,7 +636,7 @@ static int __init create_spu(void *data)
635 if (ret) 636 if (ret)
636 goto out_destroy; 637 goto out_destroy;
637 638
638 ret = spu_create_sysdev(spu); 639 ret = spu_create_dev(spu);
639 if (ret) 640 if (ret)
640 goto out_free_irqs; 641 goto out_free_irqs;
641 642
@@ -692,10 +693,10 @@ static unsigned long long spu_acct_time(struct spu *spu,
692} 693}
693 694
694 695
695static ssize_t spu_stat_show(struct sys_device *sysdev, 696static ssize_t spu_stat_show(struct device *dev,
696 struct sysdev_attribute *attr, char *buf) 697 struct device_attribute *attr, char *buf)
697{ 698{
698 struct spu *spu = container_of(sysdev, struct spu, sysdev); 699 struct spu *spu = container_of(dev, struct spu, dev);
699 700
700 return sprintf(buf, "%s %llu %llu %llu %llu " 701 return sprintf(buf, "%s %llu %llu %llu %llu "
701 "%llu %llu %llu %llu %llu %llu %llu %llu\n", 702 "%llu %llu %llu %llu %llu %llu %llu %llu\n",
@@ -714,7 +715,7 @@ static ssize_t spu_stat_show(struct sys_device *sysdev,
714 spu->stats.libassist); 715 spu->stats.libassist);
715} 716}
716 717
717static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); 718static DEVICE_ATTR(stat, 0644, spu_stat_show, NULL);
718 719
719#ifdef CONFIG_KEXEC 720#ifdef CONFIG_KEXEC
720 721
@@ -813,8 +814,8 @@ static int __init init_spu_base(void)
813 if (!spu_management_ops) 814 if (!spu_management_ops)
814 goto out; 815 goto out;
815 816
816 /* create sysdev class for spus */ 817 /* create system subsystem for spus */
817 ret = sysdev_class_register(&spu_sysdev_class); 818 ret = subsys_system_register(&spu_subsys, NULL);
818 if (ret) 819 if (ret)
819 goto out; 820 goto out;
820 821
@@ -823,7 +824,7 @@ static int __init init_spu_base(void)
823 if (ret < 0) { 824 if (ret < 0) {
824 printk(KERN_WARNING "%s: Error initializing spus\n", 825 printk(KERN_WARNING "%s: Error initializing spus\n",
825 __func__); 826 __func__);
826 goto out_unregister_sysdev_class; 827 goto out_unregister_subsys;
827 } 828 }
828 829
829 if (ret > 0) 830 if (ret > 0)
@@ -833,15 +834,15 @@ static int __init init_spu_base(void)
833 xmon_register_spus(&spu_full_list); 834 xmon_register_spus(&spu_full_list);
834 crash_register_spus(&spu_full_list); 835 crash_register_spus(&spu_full_list);
835 mutex_unlock(&spu_full_list_mutex); 836 mutex_unlock(&spu_full_list_mutex);
836 spu_add_sysdev_attr(&attr_stat); 837 spu_add_dev_attr(&dev_attr_stat);
837 register_syscore_ops(&spu_syscore_ops); 838 register_syscore_ops(&spu_syscore_ops);
838 839
839 spu_init_affinity(); 840 spu_init_affinity();
840 841
841 return 0; 842 return 0;
842 843
843 out_unregister_sysdev_class: 844 out_unregister_subsys:
844 sysdev_class_unregister(&spu_sysdev_class); 845 bus_unregister(&spu_subsys);
845 out: 846 out:
846 return ret; 847 return ret;
847} 848}
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index 7e2a5515ed76..02df49fb59f0 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -24,7 +24,7 @@
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/cache.h> 25#include <linux/cache.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/sysdev.h> 27#include <linux/device.h>
28#include <linux/cpu.h> 28#include <linux/cpu.h>
29 29
30#include <asm/ptrace.h> 30#include <asm/ptrace.h>
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 04af5f48b4eb..1fc386a23f18 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -23,7 +23,7 @@
23#include <linux/pmu.h> 23#include <linux/pmu.h>
24#include <linux/cpufreq.h> 24#include <linux/cpufreq.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/sysdev.h> 26#include <linux/device.h>
27#include <linux/hardirq.h> 27#include <linux/hardirq.h>
28#include <asm/prom.h> 28#include <asm/prom.h>
29#include <asm/machdep.h> 29#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 3cafc306b971..c638535753df 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -33,7 +33,7 @@
33#include <linux/sched.h> 33#include <linux/sched.h>
34#include <linux/stringify.h> 34#include <linux/stringify.h>
35#include <linux/swap.h> 35#include <linux/swap.h>
36#include <linux/sysdev.h> 36#include <linux/device.h>
37#include <asm/firmware.h> 37#include <asm/firmware.h>
38#include <asm/hvcall.h> 38#include <asm/hvcall.h>
39#include <asm/mmu.h> 39#include <asm/mmu.h>
@@ -65,7 +65,7 @@ static unsigned int oom_kb = CMM_OOM_KB;
65static unsigned int cmm_debug = CMM_DEBUG; 65static unsigned int cmm_debug = CMM_DEBUG;
66static unsigned int cmm_disabled = CMM_DISABLE; 66static unsigned int cmm_disabled = CMM_DISABLE;
67static unsigned long min_mem_mb = CMM_MIN_MEM_MB; 67static unsigned long min_mem_mb = CMM_MIN_MEM_MB;
68static struct sys_device cmm_sysdev; 68static struct device cmm_dev;
69 69
70MODULE_AUTHOR("Brian King <brking@linux.vnet.ibm.com>"); 70MODULE_AUTHOR("Brian King <brking@linux.vnet.ibm.com>");
71MODULE_DESCRIPTION("IBM System p Collaborative Memory Manager"); 71MODULE_DESCRIPTION("IBM System p Collaborative Memory Manager");
@@ -347,25 +347,25 @@ static int cmm_thread(void *dummy)
347} 347}
348 348
349#define CMM_SHOW(name, format, args...) \ 349#define CMM_SHOW(name, format, args...) \
350 static ssize_t show_##name(struct sys_device *dev, \ 350 static ssize_t show_##name(struct device *dev, \
351 struct sysdev_attribute *attr, \ 351 struct device_attribute *attr, \
352 char *buf) \ 352 char *buf) \
353 { \ 353 { \
354 return sprintf(buf, format, ##args); \ 354 return sprintf(buf, format, ##args); \
355 } \ 355 } \
356 static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL) 356 static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
357 357
358CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages)); 358CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages));
359CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target)); 359CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target));
360 360
361static ssize_t show_oom_pages(struct sys_device *dev, 361static ssize_t show_oom_pages(struct device *dev,
362 struct sysdev_attribute *attr, char *buf) 362 struct device_attribute *attr, char *buf)
363{ 363{
364 return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages)); 364 return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages));
365} 365}
366 366
367static ssize_t store_oom_pages(struct sys_device *dev, 367static ssize_t store_oom_pages(struct device *dev,
368 struct sysdev_attribute *attr, 368 struct device_attribute *attr,
369 const char *buf, size_t count) 369 const char *buf, size_t count)
370{ 370{
371 unsigned long val = simple_strtoul (buf, NULL, 10); 371 unsigned long val = simple_strtoul (buf, NULL, 10);
@@ -379,17 +379,18 @@ static ssize_t store_oom_pages(struct sys_device *dev,
379 return count; 379 return count;
380} 380}
381 381
382static SYSDEV_ATTR(oom_freed_kb, S_IWUSR| S_IRUGO, 382static DEVICE_ATTR(oom_freed_kb, S_IWUSR | S_IRUGO,
383 show_oom_pages, store_oom_pages); 383 show_oom_pages, store_oom_pages);
384 384
385static struct sysdev_attribute *cmm_attrs[] = { 385static struct device_attribute *cmm_attrs[] = {
386 &attr_loaned_kb, 386 &dev_attr_loaned_kb,
387 &attr_loaned_target_kb, 387 &dev_attr_loaned_target_kb,
388 &attr_oom_freed_kb, 388 &dev_attr_oom_freed_kb,
389}; 389};
390 390
391static struct sysdev_class cmm_sysdev_class = { 391static struct bus_type cmm_subsys = {
392 .name = "cmm", 392 .name = "cmm",
393 .dev_name = "cmm",
393}; 394};
394 395
395/** 396/**
@@ -398,21 +399,21 @@ static struct sysdev_class cmm_sysdev_class = {
398 * Return value: 399 * Return value:
399 * 0 on success / other on failure 400 * 0 on success / other on failure
400 **/ 401 **/
401static int cmm_sysfs_register(struct sys_device *sysdev) 402static int cmm_sysfs_register(struct device *dev)
402{ 403{
403 int i, rc; 404 int i, rc;
404 405
405 if ((rc = sysdev_class_register(&cmm_sysdev_class))) 406 if ((rc = subsys_system_register(&cmm_subsys, NULL)))
406 return rc; 407 return rc;
407 408
408 sysdev->id = 0; 409 dev->id = 0;
409 sysdev->cls = &cmm_sysdev_class; 410 dev->bus = &cmm_subsys;
410 411
411 if ((rc = sysdev_register(sysdev))) 412 if ((rc = device_register(dev)))
412 goto class_unregister; 413 goto subsys_unregister;
413 414
414 for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) { 415 for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) {
415 if ((rc = sysdev_create_file(sysdev, cmm_attrs[i]))) 416 if ((rc = device_create_file(dev, cmm_attrs[i])))
416 goto fail; 417 goto fail;
417 } 418 }
418 419
@@ -420,10 +421,10 @@ static int cmm_sysfs_register(struct sys_device *sysdev)
420 421
421fail: 422fail:
422 while (--i >= 0) 423 while (--i >= 0)
423 sysdev_remove_file(sysdev, cmm_attrs[i]); 424 device_remove_file(dev, cmm_attrs[i]);
424 sysdev_unregister(sysdev); 425 device_unregister(dev);
425class_unregister: 426subsys_unregister:
426 sysdev_class_unregister(&cmm_sysdev_class); 427 bus_unregister(&cmm_subsys);
427 return rc; 428 return rc;
428} 429}
429 430
@@ -431,14 +432,14 @@ class_unregister:
431 * cmm_unregister_sysfs - Unregister from sysfs 432 * cmm_unregister_sysfs - Unregister from sysfs
432 * 433 *
433 **/ 434 **/
434static void cmm_unregister_sysfs(struct sys_device *sysdev) 435static void cmm_unregister_sysfs(struct device *dev)
435{ 436{
436 int i; 437 int i;
437 438
438 for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) 439 for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++)
439 sysdev_remove_file(sysdev, cmm_attrs[i]); 440 device_remove_file(dev, cmm_attrs[i]);
440 sysdev_unregister(sysdev); 441 device_unregister(dev);
441 sysdev_class_unregister(&cmm_sysdev_class); 442 bus_unregister(&cmm_subsys);
442} 443}
443 444
444/** 445/**
@@ -657,7 +658,7 @@ static int cmm_init(void)
657 if ((rc = register_reboot_notifier(&cmm_reboot_nb))) 658 if ((rc = register_reboot_notifier(&cmm_reboot_nb)))
658 goto out_oom_notifier; 659 goto out_oom_notifier;
659 660
660 if ((rc = cmm_sysfs_register(&cmm_sysdev))) 661 if ((rc = cmm_sysfs_register(&cmm_dev)))
661 goto out_reboot_notifier; 662 goto out_reboot_notifier;
662 663
663 if (register_memory_notifier(&cmm_mem_nb) || 664 if (register_memory_notifier(&cmm_mem_nb) ||
@@ -678,7 +679,7 @@ static int cmm_init(void)
678out_unregister_notifier: 679out_unregister_notifier:
679 unregister_memory_notifier(&cmm_mem_nb); 680 unregister_memory_notifier(&cmm_mem_nb);
680 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb); 681 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb);
681 cmm_unregister_sysfs(&cmm_sysdev); 682 cmm_unregister_sysfs(&cmm_dev);
682out_reboot_notifier: 683out_reboot_notifier:
683 unregister_reboot_notifier(&cmm_reboot_nb); 684 unregister_reboot_notifier(&cmm_reboot_nb);
684out_oom_notifier: 685out_oom_notifier:
@@ -701,7 +702,7 @@ static void cmm_exit(void)
701 unregister_memory_notifier(&cmm_mem_nb); 702 unregister_memory_notifier(&cmm_mem_nb);
702 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb); 703 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb);
703 cmm_free_pages(loaned_pages); 704 cmm_free_pages(loaned_pages);
704 cmm_unregister_sysfs(&cmm_sysdev); 705 cmm_unregister_sysfs(&cmm_dev);
705} 706}
706 707
707/** 708/**
diff --git a/arch/powerpc/platforms/pseries/pseries_energy.c b/arch/powerpc/platforms/pseries/pseries_energy.c
index c8b3c69fe891..af281dce510a 100644
--- a/arch/powerpc/platforms/pseries/pseries_energy.c
+++ b/arch/powerpc/platforms/pseries/pseries_energy.c
@@ -15,7 +15,7 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/sysdev.h> 18#include <linux/device.h>
19#include <linux/cpu.h> 19#include <linux/cpu.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <asm/cputhreads.h> 21#include <asm/cputhreads.h>
@@ -184,7 +184,7 @@ static ssize_t get_best_energy_list(char *page, int activate)
184 return s-page; 184 return s-page;
185} 185}
186 186
187static ssize_t get_best_energy_data(struct sys_device *dev, 187static ssize_t get_best_energy_data(struct device *dev,
188 char *page, int activate) 188 char *page, int activate)
189{ 189{
190 int rc; 190 int rc;
@@ -207,26 +207,26 @@ static ssize_t get_best_energy_data(struct sys_device *dev,
207 207
208/* Wrapper functions */ 208/* Wrapper functions */
209 209
210static ssize_t cpu_activate_hint_list_show(struct sysdev_class *class, 210static ssize_t cpu_activate_hint_list_show(struct device *dev,
211 struct sysdev_class_attribute *attr, char *page) 211 struct device_attribute *attr, char *page)
212{ 212{
213 return get_best_energy_list(page, 1); 213 return get_best_energy_list(page, 1);
214} 214}
215 215
216static ssize_t cpu_deactivate_hint_list_show(struct sysdev_class *class, 216static ssize_t cpu_deactivate_hint_list_show(struct device *dev,
217 struct sysdev_class_attribute *attr, char *page) 217 struct device_attribute *attr, char *page)
218{ 218{
219 return get_best_energy_list(page, 0); 219 return get_best_energy_list(page, 0);
220} 220}
221 221
222static ssize_t percpu_activate_hint_show(struct sys_device *dev, 222static ssize_t percpu_activate_hint_show(struct device *dev,
223 struct sysdev_attribute *attr, char *page) 223 struct device_attribute *attr, char *page)
224{ 224{
225 return get_best_energy_data(dev, page, 1); 225 return get_best_energy_data(dev, page, 1);
226} 226}
227 227
228static ssize_t percpu_deactivate_hint_show(struct sys_device *dev, 228static ssize_t percpu_deactivate_hint_show(struct device *dev,
229 struct sysdev_attribute *attr, char *page) 229 struct device_attribute *attr, char *page)
230{ 230{
231 return get_best_energy_data(dev, page, 0); 231 return get_best_energy_data(dev, page, 0);
232} 232}
@@ -241,48 +241,48 @@ static ssize_t percpu_deactivate_hint_show(struct sys_device *dev,
241 * Per-cpu value of the hint 241 * Per-cpu value of the hint
242 */ 242 */
243 243
244struct sysdev_class_attribute attr_cpu_activate_hint_list = 244struct device_attribute attr_cpu_activate_hint_list =
245 _SYSDEV_CLASS_ATTR(pseries_activate_hint_list, 0444, 245 __ATTR(pseries_activate_hint_list, 0444,
246 cpu_activate_hint_list_show, NULL); 246 cpu_activate_hint_list_show, NULL);
247 247
248struct sysdev_class_attribute attr_cpu_deactivate_hint_list = 248struct device_attribute attr_cpu_deactivate_hint_list =
249 _SYSDEV_CLASS_ATTR(pseries_deactivate_hint_list, 0444, 249 __ATTR(pseries_deactivate_hint_list, 0444,
250 cpu_deactivate_hint_list_show, NULL); 250 cpu_deactivate_hint_list_show, NULL);
251 251
252struct sysdev_attribute attr_percpu_activate_hint = 252struct device_attribute attr_percpu_activate_hint =
253 _SYSDEV_ATTR(pseries_activate_hint, 0444, 253 __ATTR(pseries_activate_hint, 0444,
254 percpu_activate_hint_show, NULL); 254 percpu_activate_hint_show, NULL);
255 255
256struct sysdev_attribute attr_percpu_deactivate_hint = 256struct device_attribute attr_percpu_deactivate_hint =
257 _SYSDEV_ATTR(pseries_deactivate_hint, 0444, 257 __ATTR(pseries_deactivate_hint, 0444,
258 percpu_deactivate_hint_show, NULL); 258 percpu_deactivate_hint_show, NULL);
259 259
260static int __init pseries_energy_init(void) 260static int __init pseries_energy_init(void)
261{ 261{
262 int cpu, err; 262 int cpu, err;
263 struct sys_device *cpu_sys_dev; 263 struct device *cpu_dev;
264 264
265 if (!check_for_h_best_energy()) { 265 if (!check_for_h_best_energy()) {
266 printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n"); 266 printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n");
267 return 0; 267 return 0;
268 } 268 }
269 /* Create the sysfs files */ 269 /* Create the sysfs files */
270 err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 270 err = device_create_file(cpu_subsys.dev_root,
271 &attr_cpu_activate_hint_list.attr); 271 &attr_cpu_activate_hint_list);
272 if (!err) 272 if (!err)
273 err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, 273 err = device_create_file(cpu_subsys.dev_root,
274 &attr_cpu_deactivate_hint_list.attr); 274 &attr_cpu_deactivate_hint_list);
275 275
276 if (err) 276 if (err)
277 return err; 277 return err;
278 for_each_possible_cpu(cpu) { 278 for_each_possible_cpu(cpu) {
279 cpu_sys_dev = get_cpu_sysdev(cpu); 279 cpu_dev = get_cpu_device(cpu);
280 err = sysfs_create_file(&cpu_sys_dev->kobj, 280 err = device_create_file(cpu_dev,
281 &attr_percpu_activate_hint.attr); 281 &attr_percpu_activate_hint);
282 if (err) 282 if (err)
283 break; 283 break;
284 err = sysfs_create_file(&cpu_sys_dev->kobj, 284 err = device_create_file(cpu_dev,
285 &attr_percpu_deactivate_hint.attr); 285 &attr_percpu_deactivate_hint);
286 if (err) 286 if (err)
287 break; 287 break;
288 } 288 }
@@ -298,23 +298,20 @@ static int __init pseries_energy_init(void)
298static void __exit pseries_energy_cleanup(void) 298static void __exit pseries_energy_cleanup(void)
299{ 299{
300 int cpu; 300 int cpu;
301 struct sys_device *cpu_sys_dev; 301 struct device *cpu_dev;
302 302
303 if (!sysfs_entries) 303 if (!sysfs_entries)
304 return; 304 return;
305 305
306 /* Remove the sysfs files */ 306 /* Remove the sysfs files */
307 sysfs_remove_file(&cpu_sysdev_class.kset.kobj, 307 device_remove_file(cpu_subsys.dev_root, &attr_cpu_activate_hint_list);
308 &attr_cpu_activate_hint_list.attr); 308 device_remove_file(cpu_subsys.dev_root, &attr_cpu_deactivate_hint_list);
309
310 sysfs_remove_file(&cpu_sysdev_class.kset.kobj,
311 &attr_cpu_deactivate_hint_list.attr);
312 309
313 for_each_possible_cpu(cpu) { 310 for_each_possible_cpu(cpu) {
314 cpu_sys_dev = get_cpu_sysdev(cpu); 311 cpu_dev = get_cpu_device(cpu);
315 sysfs_remove_file(&cpu_sys_dev->kobj, 312 sysfs_remove_file(&cpu_dev->kobj,
316 &attr_percpu_activate_hint.attr); 313 &attr_percpu_activate_hint.attr);
317 sysfs_remove_file(&cpu_sys_dev->kobj, 314 sysfs_remove_file(&cpu_dev->kobj,
318 &attr_percpu_deactivate_hint.attr); 315 &attr_percpu_deactivate_hint.attr);
319 } 316 }
320} 317}
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 26e93fd4c62b..6212ff4693ea 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -22,7 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/cache.h> 23#include <linux/cache.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/sysdev.h> 25#include <linux/device.h>
26#include <linux/cpu.h> 26#include <linux/cpu.h>
27 27
28#include <asm/ptrace.h> 28#include <asm/ptrace.h>
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index d3de0849f296..b84a8b2238dd 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -26,7 +26,7 @@
26#include <asm/rtas.h> 26#include <asm/rtas.h>
27 27
28static u64 stream_id; 28static u64 stream_id;
29static struct sys_device suspend_sysdev; 29static struct device suspend_dev;
30static DECLARE_COMPLETION(suspend_work); 30static DECLARE_COMPLETION(suspend_work);
31static struct rtas_suspend_me_data suspend_data; 31static struct rtas_suspend_me_data suspend_data;
32static atomic_t suspending; 32static atomic_t suspending;
@@ -110,8 +110,8 @@ static int pseries_prepare_late(void)
110 110
111/** 111/**
112 * store_hibernate - Initiate partition hibernation 112 * store_hibernate - Initiate partition hibernation
113 * @classdev: sysdev class struct 113 * @dev: subsys root device
114 * @attr: class device attribute struct 114 * @attr: device attribute struct
115 * @buf: buffer 115 * @buf: buffer
116 * @count: buffer size 116 * @count: buffer size
117 * 117 *
@@ -121,8 +121,8 @@ static int pseries_prepare_late(void)
121 * Return value: 121 * Return value:
122 * number of bytes printed to buffer / other on failure 122 * number of bytes printed to buffer / other on failure
123 **/ 123 **/
124static ssize_t store_hibernate(struct sysdev_class *classdev, 124static ssize_t store_hibernate(struct device *dev,
125 struct sysdev_class_attribute *attr, 125 struct device_attribute *attr,
126 const char *buf, size_t count) 126 const char *buf, size_t count)
127{ 127{
128 int rc; 128 int rc;
@@ -148,10 +148,11 @@ static ssize_t store_hibernate(struct sysdev_class *classdev,
148 return rc; 148 return rc;
149} 149}
150 150
151static SYSDEV_CLASS_ATTR(hibernate, S_IWUSR, NULL, store_hibernate); 151static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
152 152
153static struct sysdev_class suspend_sysdev_class = { 153static struct bus_type suspend_subsys = {
154 .name = "power", 154 .name = "power",
155 .dev_name = "power",
155}; 156};
156 157
157static const struct platform_suspend_ops pseries_suspend_ops = { 158static const struct platform_suspend_ops pseries_suspend_ops = {
@@ -167,23 +168,23 @@ static const struct platform_suspend_ops pseries_suspend_ops = {
167 * Return value: 168 * Return value:
168 * 0 on success / other on failure 169 * 0 on success / other on failure
169 **/ 170 **/
170static int pseries_suspend_sysfs_register(struct sys_device *sysdev) 171static int pseries_suspend_sysfs_register(struct device *dev)
171{ 172{
172 int rc; 173 int rc;
173 174
174 if ((rc = sysdev_class_register(&suspend_sysdev_class))) 175 if ((rc = subsys_system_register(&suspend_subsys, NULL)))
175 return rc; 176 return rc;
176 177
177 sysdev->id = 0; 178 dev->id = 0;
178 sysdev->cls = &suspend_sysdev_class; 179 dev->bus = &suspend_subsys;
179 180
180 if ((rc = sysdev_class_create_file(&suspend_sysdev_class, &attr_hibernate))) 181 if ((rc = device_create_file(suspend_subsys.dev_root, &dev_attr_hibernate)))
181 goto class_unregister; 182 goto subsys_unregister;
182 183
183 return 0; 184 return 0;
184 185
185class_unregister: 186subsys_unregister:
186 sysdev_class_unregister(&suspend_sysdev_class); 187 bus_unregister(&suspend_subsys);
187 return rc; 188 return rc;
188} 189}
189 190
@@ -204,7 +205,7 @@ static int __init pseries_suspend_init(void)
204 if (suspend_data.token == RTAS_UNKNOWN_SERVICE) 205 if (suspend_data.token == RTAS_UNKNOWN_SERVICE)
205 return 0; 206 return 0;
206 207
207 if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev))) 208 if ((rc = pseries_suspend_sysfs_register(&suspend_dev)))
208 return rc; 209 return rc;
209 210
210 ppc_md.suspend_disable_cpu = pseries_suspend_cpu; 211 ppc_md.suspend_disable_cpu = pseries_suspend_cpu;
diff --git a/arch/powerpc/sysdev/ppc4xx_cpm.c b/arch/powerpc/sysdev/ppc4xx_cpm.c
index 73b86cc5ea74..82e2cfe35c62 100644
--- a/arch/powerpc/sysdev/ppc4xx_cpm.c
+++ b/arch/powerpc/sysdev/ppc4xx_cpm.c
@@ -179,12 +179,12 @@ static struct kobj_attribute cpm_idle_attr =
179 179
180static void cpm_idle_config_sysfs(void) 180static void cpm_idle_config_sysfs(void)
181{ 181{
182 struct sys_device *sys_dev; 182 struct device *dev;
183 unsigned long ret; 183 unsigned long ret;
184 184
185 sys_dev = get_cpu_sysdev(0); 185 dev = get_cpu_device(0);
186 186
187 ret = sysfs_create_file(&sys_dev->kobj, 187 ret = sysfs_create_file(&dev->kobj,
188 &cpm_idle_attr.attr); 188 &cpm_idle_attr.attr);
189 if (ret) 189 if (ret)
190 printk(KERN_WARNING 190 printk(KERN_WARNING
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 18e75ca19fe6..73034bd203c4 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -22,7 +22,6 @@
22#include <linux/stddef.h> 22#include <linux/stddef.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/signal.h> 24#include <linux/signal.h>
25#include <linux/sysdev.h>
26#include <linux/device.h> 25#include <linux/device.h>
27#include <linux/bootmem.h> 26#include <linux/bootmem.h>
28#include <linux/spinlock.h> 27#include <linux/spinlock.h>
@@ -484,13 +483,14 @@ int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high)
484 return 0; 483 return 0;
485} 484}
486 485
487static struct sysdev_class qe_ic_sysclass = { 486static struct bus_type qe_ic_subsys = {
488 .name = "qe_ic", 487 .name = "qe_ic",
488 .dev_name = "qe_ic",
489}; 489};
490 490
491static struct sys_device device_qe_ic = { 491static struct device device_qe_ic = {
492 .id = 0, 492 .id = 0,
493 .cls = &qe_ic_sysclass, 493 .bus = &qe_ic_subsys,
494}; 494};
495 495
496static int __init init_qe_ic_sysfs(void) 496static int __init init_qe_ic_sysfs(void)
@@ -499,12 +499,12 @@ static int __init init_qe_ic_sysfs(void)
499 499
500 printk(KERN_DEBUG "Registering qe_ic with sysfs...\n"); 500 printk(KERN_DEBUG "Registering qe_ic with sysfs...\n");
501 501
502 rc = sysdev_class_register(&qe_ic_sysclass); 502 rc = subsys_system_register(&qe_ic_subsys, NULL);
503 if (rc) { 503 if (rc) {
504 printk(KERN_ERR "Failed registering qe_ic sys class\n"); 504 printk(KERN_ERR "Failed registering qe_ic sys class\n");
505 return -ENODEV; 505 return -ENODEV;
506 } 506 }
507 rc = sysdev_register(&device_qe_ic); 507 rc = device_register(&device_qe_ic);
508 if (rc) { 508 if (rc) {
509 printk(KERN_ERR "Failed registering qe_ic sys device\n"); 509 printk(KERN_ERR "Failed registering qe_ic sys device\n");
510 return -ENODEV; 510 return -ENODEV;
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 3330feca7502..063c901b1265 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -18,7 +18,6 @@
18#include <linux/stddef.h> 18#include <linux/stddef.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/signal.h> 20#include <linux/signal.h>
21#include <linux/sysdev.h>
22#include <linux/device.h> 21#include <linux/device.h>
23#include <linux/bootmem.h> 22#include <linux/bootmem.h>
24#include <linux/spinlock.h> 23#include <linux/spinlock.h>
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 3ea872890da2..66cca03c0282 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -831,8 +831,8 @@ int setup_profiling_timer(unsigned int multiplier)
831} 831}
832 832
833#ifdef CONFIG_HOTPLUG_CPU 833#ifdef CONFIG_HOTPLUG_CPU
834static ssize_t cpu_configure_show(struct sys_device *dev, 834static ssize_t cpu_configure_show(struct device *dev,
835 struct sysdev_attribute *attr, char *buf) 835 struct device_attribute *attr, char *buf)
836{ 836{
837 ssize_t count; 837 ssize_t count;
838 838
@@ -842,8 +842,8 @@ static ssize_t cpu_configure_show(struct sys_device *dev,
842 return count; 842 return count;
843} 843}
844 844
845static ssize_t cpu_configure_store(struct sys_device *dev, 845static ssize_t cpu_configure_store(struct device *dev,
846 struct sysdev_attribute *attr, 846 struct device_attribute *attr,
847 const char *buf, size_t count) 847 const char *buf, size_t count)
848{ 848{
849 int cpu = dev->id; 849 int cpu = dev->id;
@@ -889,11 +889,11 @@ out:
889 put_online_cpus(); 889 put_online_cpus();
890 return rc ? rc : count; 890 return rc ? rc : count;
891} 891}
892static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); 892static DEVICE_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
893#endif /* CONFIG_HOTPLUG_CPU */ 893#endif /* CONFIG_HOTPLUG_CPU */
894 894
895static ssize_t cpu_polarization_show(struct sys_device *dev, 895static ssize_t cpu_polarization_show(struct device *dev,
896 struct sysdev_attribute *attr, char *buf) 896 struct device_attribute *attr, char *buf)
897{ 897{
898 int cpu = dev->id; 898 int cpu = dev->id;
899 ssize_t count; 899 ssize_t count;
@@ -919,22 +919,22 @@ static ssize_t cpu_polarization_show(struct sys_device *dev,
919 mutex_unlock(&smp_cpu_state_mutex); 919 mutex_unlock(&smp_cpu_state_mutex);
920 return count; 920 return count;
921} 921}
922static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); 922static DEVICE_ATTR(polarization, 0444, cpu_polarization_show, NULL);
923 923
924static ssize_t show_cpu_address(struct sys_device *dev, 924static ssize_t show_cpu_address(struct device *dev,
925 struct sysdev_attribute *attr, char *buf) 925 struct device_attribute *attr, char *buf)
926{ 926{
927 return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); 927 return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]);
928} 928}
929static SYSDEV_ATTR(address, 0444, show_cpu_address, NULL); 929static DEVICE_ATTR(address, 0444, show_cpu_address, NULL);
930 930
931 931
932static struct attribute *cpu_common_attrs[] = { 932static struct attribute *cpu_common_attrs[] = {
933#ifdef CONFIG_HOTPLUG_CPU 933#ifdef CONFIG_HOTPLUG_CPU
934 &attr_configure.attr, 934 &dev_attr_configure.attr,
935#endif 935#endif
936 &attr_address.attr, 936 &dev_attr_address.attr,
937 &attr_polarization.attr, 937 &dev_attr_polarization.attr,
938 NULL, 938 NULL,
939}; 939};
940 940
@@ -942,8 +942,8 @@ static struct attribute_group cpu_common_attr_group = {
942 .attrs = cpu_common_attrs, 942 .attrs = cpu_common_attrs,
943}; 943};
944 944
945static ssize_t show_capability(struct sys_device *dev, 945static ssize_t show_capability(struct device *dev,
946 struct sysdev_attribute *attr, char *buf) 946 struct device_attribute *attr, char *buf)
947{ 947{
948 unsigned int capability; 948 unsigned int capability;
949 int rc; 949 int rc;
@@ -953,10 +953,10 @@ static ssize_t show_capability(struct sys_device *dev,
953 return rc; 953 return rc;
954 return sprintf(buf, "%u\n", capability); 954 return sprintf(buf, "%u\n", capability);
955} 955}
956static SYSDEV_ATTR(capability, 0444, show_capability, NULL); 956static DEVICE_ATTR(capability, 0444, show_capability, NULL);
957 957
958static ssize_t show_idle_count(struct sys_device *dev, 958static ssize_t show_idle_count(struct device *dev,
959 struct sysdev_attribute *attr, char *buf) 959 struct device_attribute *attr, char *buf)
960{ 960{
961 struct s390_idle_data *idle; 961 struct s390_idle_data *idle;
962 unsigned long long idle_count; 962 unsigned long long idle_count;
@@ -976,10 +976,10 @@ repeat:
976 goto repeat; 976 goto repeat;
977 return sprintf(buf, "%llu\n", idle_count); 977 return sprintf(buf, "%llu\n", idle_count);
978} 978}
979static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); 979static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
980 980
981static ssize_t show_idle_time(struct sys_device *dev, 981static ssize_t show_idle_time(struct device *dev,
982 struct sysdev_attribute *attr, char *buf) 982 struct device_attribute *attr, char *buf)
983{ 983{
984 struct s390_idle_data *idle; 984 struct s390_idle_data *idle;
985 unsigned long long now, idle_time, idle_enter; 985 unsigned long long now, idle_time, idle_enter;
@@ -1001,12 +1001,12 @@ repeat:
1001 goto repeat; 1001 goto repeat;
1002 return sprintf(buf, "%llu\n", idle_time >> 12); 1002 return sprintf(buf, "%llu\n", idle_time >> 12);
1003} 1003}
1004static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL); 1004static DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);
1005 1005
1006static struct attribute *cpu_online_attrs[] = { 1006static struct attribute *cpu_online_attrs[] = {
1007 &attr_capability.attr, 1007 &dev_attr_capability.attr,
1008 &attr_idle_count.attr, 1008 &dev_attr_idle_count.attr,
1009 &attr_idle_time_us.attr, 1009 &dev_attr_idle_time_us.attr,
1010 NULL, 1010 NULL,
1011}; 1011};
1012 1012
@@ -1019,7 +1019,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
1019{ 1019{
1020 unsigned int cpu = (unsigned int)(long)hcpu; 1020 unsigned int cpu = (unsigned int)(long)hcpu;
1021 struct cpu *c = &per_cpu(cpu_devices, cpu); 1021 struct cpu *c = &per_cpu(cpu_devices, cpu);
1022 struct sys_device *s = &c->sysdev; 1022 struct device *s = &c->dev;
1023 struct s390_idle_data *idle; 1023 struct s390_idle_data *idle;
1024 int err = 0; 1024 int err = 0;
1025 1025
@@ -1045,7 +1045,7 @@ static struct notifier_block __cpuinitdata smp_cpu_nb = {
1045static int __devinit smp_add_present_cpu(int cpu) 1045static int __devinit smp_add_present_cpu(int cpu)
1046{ 1046{
1047 struct cpu *c = &per_cpu(cpu_devices, cpu); 1047 struct cpu *c = &per_cpu(cpu_devices, cpu);
1048 struct sys_device *s = &c->sysdev; 1048 struct device *s = &c->dev;
1049 int rc; 1049 int rc;
1050 1050
1051 c->hotpluggable = 1; 1051 c->hotpluggable = 1;
@@ -1098,8 +1098,8 @@ out:
1098 return rc; 1098 return rc;
1099} 1099}
1100 1100
1101static ssize_t __ref rescan_store(struct sysdev_class *class, 1101static ssize_t __ref rescan_store(struct device *dev,
1102 struct sysdev_class_attribute *attr, 1102 struct device_attribute *attr,
1103 const char *buf, 1103 const char *buf,
1104 size_t count) 1104 size_t count)
1105{ 1105{
@@ -1108,11 +1108,11 @@ static ssize_t __ref rescan_store(struct sysdev_class *class,
1108 rc = smp_rescan_cpus(); 1108 rc = smp_rescan_cpus();
1109 return rc ? rc : count; 1109 return rc ? rc : count;
1110} 1110}
1111static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); 1111static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
1112#endif /* CONFIG_HOTPLUG_CPU */ 1112#endif /* CONFIG_HOTPLUG_CPU */
1113 1113
1114static ssize_t dispatching_show(struct sysdev_class *class, 1114static ssize_t dispatching_show(struct device *dev,
1115 struct sysdev_class_attribute *attr, 1115 struct device_attribute *attr,
1116 char *buf) 1116 char *buf)
1117{ 1117{
1118 ssize_t count; 1118 ssize_t count;
@@ -1123,8 +1123,8 @@ static ssize_t dispatching_show(struct sysdev_class *class,
1123 return count; 1123 return count;
1124} 1124}
1125 1125
1126static ssize_t dispatching_store(struct sysdev_class *dev, 1126static ssize_t dispatching_store(struct device *dev,
1127 struct sysdev_class_attribute *attr, 1127 struct device_attribute *attr,
1128 const char *buf, 1128 const char *buf,
1129 size_t count) 1129 size_t count)
1130{ 1130{
@@ -1148,7 +1148,7 @@ out:
1148 put_online_cpus(); 1148 put_online_cpus();
1149 return rc ? rc : count; 1149 return rc ? rc : count;
1150} 1150}
1151static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, 1151static DEVICE_ATTR(dispatching, 0644, dispatching_show,
1152 dispatching_store); 1152 dispatching_store);
1153 1153
1154static int __init topology_init(void) 1154static int __init topology_init(void)
@@ -1159,11 +1159,11 @@ static int __init topology_init(void)
1159 register_cpu_notifier(&smp_cpu_nb); 1159 register_cpu_notifier(&smp_cpu_nb);
1160 1160
1161#ifdef CONFIG_HOTPLUG_CPU 1161#ifdef CONFIG_HOTPLUG_CPU
1162 rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan); 1162 rc = device_create_file(cpu_subsys.dev_root, &dev_attr_rescan);
1163 if (rc) 1163 if (rc)
1164 return rc; 1164 return rc;
1165#endif 1165#endif
1166 rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching); 1166 rc = device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching);
1167 if (rc) 1167 if (rc)
1168 return rc; 1168 return rc;
1169 for_each_present_cpu(cpu) { 1169 for_each_present_cpu(cpu) {
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index ebbfab3c6e5a..fa02f443f5f6 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -27,7 +27,7 @@
27#include <linux/cpu.h> 27#include <linux/cpu.h>
28#include <linux/stop_machine.h> 28#include <linux/stop_machine.h>
29#include <linux/time.h> 29#include <linux/time.h>
30#include <linux/sysdev.h> 30#include <linux/device.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/smp.h> 33#include <linux/smp.h>
@@ -1116,34 +1116,35 @@ out_unlock:
1116/* 1116/*
1117 * Sysfs interface functions 1117 * Sysfs interface functions
1118 */ 1118 */
1119static struct sysdev_class etr_sysclass = { 1119static struct bus_type etr_subsys = {
1120 .name = "etr", 1120 .name = "etr",
1121 .dev_name = "etr",
1121}; 1122};
1122 1123
1123static struct sys_device etr_port0_dev = { 1124static struct device etr_port0_dev = {
1124 .id = 0, 1125 .id = 0,
1125 .cls = &etr_sysclass, 1126 .bus = &etr_subsys,
1126}; 1127};
1127 1128
1128static struct sys_device etr_port1_dev = { 1129static struct device etr_port1_dev = {
1129 .id = 1, 1130 .id = 1,
1130 .cls = &etr_sysclass, 1131 .bus = &etr_subsys,
1131}; 1132};
1132 1133
1133/* 1134/*
1134 * ETR class attributes 1135 * ETR subsys attributes
1135 */ 1136 */
1136static ssize_t etr_stepping_port_show(struct sysdev_class *class, 1137static ssize_t etr_stepping_port_show(struct device *dev,
1137 struct sysdev_class_attribute *attr, 1138 struct device_attribute *attr,
1138 char *buf) 1139 char *buf)
1139{ 1140{
1140 return sprintf(buf, "%i\n", etr_port0.esw.p); 1141 return sprintf(buf, "%i\n", etr_port0.esw.p);
1141} 1142}
1142 1143
1143static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); 1144static DEVICE_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL);
1144 1145
1145static ssize_t etr_stepping_mode_show(struct sysdev_class *class, 1146static ssize_t etr_stepping_mode_show(struct device *dev,
1146 struct sysdev_class_attribute *attr, 1147 struct device_attribute *attr,
1147 char *buf) 1148 char *buf)
1148{ 1149{
1149 char *mode_str; 1150 char *mode_str;
@@ -1157,12 +1158,12 @@ static ssize_t etr_stepping_mode_show(struct sysdev_class *class,
1157 return sprintf(buf, "%s\n", mode_str); 1158 return sprintf(buf, "%s\n", mode_str);
1158} 1159}
1159 1160
1160static SYSDEV_CLASS_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL); 1161static DEVICE_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL);
1161 1162
1162/* 1163/*
1163 * ETR port attributes 1164 * ETR port attributes
1164 */ 1165 */
1165static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev) 1166static inline struct etr_aib *etr_aib_from_dev(struct device *dev)
1166{ 1167{
1167 if (dev == &etr_port0_dev) 1168 if (dev == &etr_port0_dev)
1168 return etr_port0_online ? &etr_port0 : NULL; 1169 return etr_port0_online ? &etr_port0 : NULL;
@@ -1170,8 +1171,8 @@ static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev)
1170 return etr_port1_online ? &etr_port1 : NULL; 1171 return etr_port1_online ? &etr_port1 : NULL;
1171} 1172}
1172 1173
1173static ssize_t etr_online_show(struct sys_device *dev, 1174static ssize_t etr_online_show(struct device *dev,
1174 struct sysdev_attribute *attr, 1175 struct device_attribute *attr,
1175 char *buf) 1176 char *buf)
1176{ 1177{
1177 unsigned int online; 1178 unsigned int online;
@@ -1180,8 +1181,8 @@ static ssize_t etr_online_show(struct sys_device *dev,
1180 return sprintf(buf, "%i\n", online); 1181 return sprintf(buf, "%i\n", online);
1181} 1182}
1182 1183
1183static ssize_t etr_online_store(struct sys_device *dev, 1184static ssize_t etr_online_store(struct device *dev,
1184 struct sysdev_attribute *attr, 1185 struct device_attribute *attr,
1185 const char *buf, size_t count) 1186 const char *buf, size_t count)
1186{ 1187{
1187 unsigned int value; 1188 unsigned int value;
@@ -1218,20 +1219,20 @@ out:
1218 return count; 1219 return count;
1219} 1220}
1220 1221
1221static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); 1222static DEVICE_ATTR(online, 0600, etr_online_show, etr_online_store);
1222 1223
1223static ssize_t etr_stepping_control_show(struct sys_device *dev, 1224static ssize_t etr_stepping_control_show(struct device *dev,
1224 struct sysdev_attribute *attr, 1225 struct device_attribute *attr,
1225 char *buf) 1226 char *buf)
1226{ 1227{
1227 return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? 1228 return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ?
1228 etr_eacr.e0 : etr_eacr.e1); 1229 etr_eacr.e0 : etr_eacr.e1);
1229} 1230}
1230 1231
1231static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); 1232static DEVICE_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL);
1232 1233
1233static ssize_t etr_mode_code_show(struct sys_device *dev, 1234static ssize_t etr_mode_code_show(struct device *dev,
1234 struct sysdev_attribute *attr, char *buf) 1235 struct device_attribute *attr, char *buf)
1235{ 1236{
1236 if (!etr_port0_online && !etr_port1_online) 1237 if (!etr_port0_online && !etr_port1_online)
1237 /* Status word is not uptodate if both ports are offline. */ 1238 /* Status word is not uptodate if both ports are offline. */
@@ -1240,10 +1241,10 @@ static ssize_t etr_mode_code_show(struct sys_device *dev,
1240 etr_port0.esw.psc0 : etr_port0.esw.psc1); 1241 etr_port0.esw.psc0 : etr_port0.esw.psc1);
1241} 1242}
1242 1243
1243static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); 1244static DEVICE_ATTR(state_code, 0400, etr_mode_code_show, NULL);
1244 1245
1245static ssize_t etr_untuned_show(struct sys_device *dev, 1246static ssize_t etr_untuned_show(struct device *dev,
1246 struct sysdev_attribute *attr, char *buf) 1247 struct device_attribute *attr, char *buf)
1247{ 1248{
1248 struct etr_aib *aib = etr_aib_from_dev(dev); 1249 struct etr_aib *aib = etr_aib_from_dev(dev);
1249 1250
@@ -1252,10 +1253,10 @@ static ssize_t etr_untuned_show(struct sys_device *dev,
1252 return sprintf(buf, "%i\n", aib->edf1.u); 1253 return sprintf(buf, "%i\n", aib->edf1.u);
1253} 1254}
1254 1255
1255static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); 1256static DEVICE_ATTR(untuned, 0400, etr_untuned_show, NULL);
1256 1257
1257static ssize_t etr_network_id_show(struct sys_device *dev, 1258static ssize_t etr_network_id_show(struct device *dev,
1258 struct sysdev_attribute *attr, char *buf) 1259 struct device_attribute *attr, char *buf)
1259{ 1260{
1260 struct etr_aib *aib = etr_aib_from_dev(dev); 1261 struct etr_aib *aib = etr_aib_from_dev(dev);
1261 1262
@@ -1264,10 +1265,10 @@ static ssize_t etr_network_id_show(struct sys_device *dev,
1264 return sprintf(buf, "%i\n", aib->edf1.net_id); 1265 return sprintf(buf, "%i\n", aib->edf1.net_id);
1265} 1266}
1266 1267
1267static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); 1268static DEVICE_ATTR(network, 0400, etr_network_id_show, NULL);
1268 1269
1269static ssize_t etr_id_show(struct sys_device *dev, 1270static ssize_t etr_id_show(struct device *dev,
1270 struct sysdev_attribute *attr, char *buf) 1271 struct device_attribute *attr, char *buf)
1271{ 1272{
1272 struct etr_aib *aib = etr_aib_from_dev(dev); 1273 struct etr_aib *aib = etr_aib_from_dev(dev);
1273 1274
@@ -1276,10 +1277,10 @@ static ssize_t etr_id_show(struct sys_device *dev,
1276 return sprintf(buf, "%i\n", aib->edf1.etr_id); 1277 return sprintf(buf, "%i\n", aib->edf1.etr_id);
1277} 1278}
1278 1279
1279static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); 1280static DEVICE_ATTR(id, 0400, etr_id_show, NULL);
1280 1281
1281static ssize_t etr_port_number_show(struct sys_device *dev, 1282static ssize_t etr_port_number_show(struct device *dev,
1282 struct sysdev_attribute *attr, char *buf) 1283 struct device_attribute *attr, char *buf)
1283{ 1284{
1284 struct etr_aib *aib = etr_aib_from_dev(dev); 1285 struct etr_aib *aib = etr_aib_from_dev(dev);
1285 1286
@@ -1288,10 +1289,10 @@ static ssize_t etr_port_number_show(struct sys_device *dev,
1288 return sprintf(buf, "%i\n", aib->edf1.etr_pn); 1289 return sprintf(buf, "%i\n", aib->edf1.etr_pn);
1289} 1290}
1290 1291
1291static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); 1292static DEVICE_ATTR(port, 0400, etr_port_number_show, NULL);
1292 1293
1293static ssize_t etr_coupled_show(struct sys_device *dev, 1294static ssize_t etr_coupled_show(struct device *dev,
1294 struct sysdev_attribute *attr, char *buf) 1295 struct device_attribute *attr, char *buf)
1295{ 1296{
1296 struct etr_aib *aib = etr_aib_from_dev(dev); 1297 struct etr_aib *aib = etr_aib_from_dev(dev);
1297 1298
@@ -1300,10 +1301,10 @@ static ssize_t etr_coupled_show(struct sys_device *dev,
1300 return sprintf(buf, "%i\n", aib->edf3.c); 1301 return sprintf(buf, "%i\n", aib->edf3.c);
1301} 1302}
1302 1303
1303static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); 1304static DEVICE_ATTR(coupled, 0400, etr_coupled_show, NULL);
1304 1305
1305static ssize_t etr_local_time_show(struct sys_device *dev, 1306static ssize_t etr_local_time_show(struct device *dev,
1306 struct sysdev_attribute *attr, char *buf) 1307 struct device_attribute *attr, char *buf)
1307{ 1308{
1308 struct etr_aib *aib = etr_aib_from_dev(dev); 1309 struct etr_aib *aib = etr_aib_from_dev(dev);
1309 1310
@@ -1312,10 +1313,10 @@ static ssize_t etr_local_time_show(struct sys_device *dev,
1312 return sprintf(buf, "%i\n", aib->edf3.blto); 1313 return sprintf(buf, "%i\n", aib->edf3.blto);
1313} 1314}
1314 1315
1315static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); 1316static DEVICE_ATTR(local_time, 0400, etr_local_time_show, NULL);
1316 1317
1317static ssize_t etr_utc_offset_show(struct sys_device *dev, 1318static ssize_t etr_utc_offset_show(struct device *dev,
1318 struct sysdev_attribute *attr, char *buf) 1319 struct device_attribute *attr, char *buf)
1319{ 1320{
1320 struct etr_aib *aib = etr_aib_from_dev(dev); 1321 struct etr_aib *aib = etr_aib_from_dev(dev);
1321 1322
@@ -1324,64 +1325,64 @@ static ssize_t etr_utc_offset_show(struct sys_device *dev,
1324 return sprintf(buf, "%i\n", aib->edf3.buo); 1325 return sprintf(buf, "%i\n", aib->edf3.buo);
1325} 1326}
1326 1327
1327static SYSDEV_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL); 1328static DEVICE_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL);
1328 1329
1329static struct sysdev_attribute *etr_port_attributes[] = { 1330static struct device_attribute *etr_port_attributes[] = {
1330 &attr_online, 1331 &dev_attr_online,
1331 &attr_stepping_control, 1332 &dev_attr_stepping_control,
1332 &attr_state_code, 1333 &dev_attr_state_code,
1333 &attr_untuned, 1334 &dev_attr_untuned,
1334 &attr_network, 1335 &dev_attr_network,
1335 &attr_id, 1336 &dev_attr_id,
1336 &attr_port, 1337 &dev_attr_port,
1337 &attr_coupled, 1338 &dev_attr_coupled,
1338 &attr_local_time, 1339 &dev_attr_local_time,
1339 &attr_utc_offset, 1340 &dev_attr_utc_offset,
1340 NULL 1341 NULL
1341}; 1342};
1342 1343
1343static int __init etr_register_port(struct sys_device *dev) 1344static int __init etr_register_port(struct device *dev)
1344{ 1345{
1345 struct sysdev_attribute **attr; 1346 struct device_attribute **attr;
1346 int rc; 1347 int rc;
1347 1348
1348 rc = sysdev_register(dev); 1349 rc = device_register(dev);
1349 if (rc) 1350 if (rc)
1350 goto out; 1351 goto out;
1351 for (attr = etr_port_attributes; *attr; attr++) { 1352 for (attr = etr_port_attributes; *attr; attr++) {
1352 rc = sysdev_create_file(dev, *attr); 1353 rc = device_create_file(dev, *attr);
1353 if (rc) 1354 if (rc)
1354 goto out_unreg; 1355 goto out_unreg;
1355 } 1356 }
1356 return 0; 1357 return 0;
1357out_unreg: 1358out_unreg:
1358 for (; attr >= etr_port_attributes; attr--) 1359 for (; attr >= etr_port_attributes; attr--)
1359 sysdev_remove_file(dev, *attr); 1360 device_remove_file(dev, *attr);
1360 sysdev_unregister(dev); 1361 device_unregister(dev);
1361out: 1362out:
1362 return rc; 1363 return rc;
1363} 1364}
1364 1365
1365static void __init etr_unregister_port(struct sys_device *dev) 1366static void __init etr_unregister_port(struct device *dev)
1366{ 1367{
1367 struct sysdev_attribute **attr; 1368 struct device_attribute **attr;
1368 1369
1369 for (attr = etr_port_attributes; *attr; attr++) 1370 for (attr = etr_port_attributes; *attr; attr++)
1370 sysdev_remove_file(dev, *attr); 1371 device_remove_file(dev, *attr);
1371 sysdev_unregister(dev); 1372 device_unregister(dev);
1372} 1373}
1373 1374
1374static int __init etr_init_sysfs(void) 1375static int __init etr_init_sysfs(void)
1375{ 1376{
1376 int rc; 1377 int rc;
1377 1378
1378 rc = sysdev_class_register(&etr_sysclass); 1379 rc = subsys_system_register(&etr_subsys, NULL);
1379 if (rc) 1380 if (rc)
1380 goto out; 1381 goto out;
1381 rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_port); 1382 rc = device_create_file(etr_subsys.dev_root, &dev_attr_stepping_port);
1382 if (rc) 1383 if (rc)
1383 goto out_unreg_class; 1384 goto out_unreg_subsys;
1384 rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_mode); 1385 rc = device_create_file(etr_subsys.dev_root, &dev_attr_stepping_mode);
1385 if (rc) 1386 if (rc)
1386 goto out_remove_stepping_port; 1387 goto out_remove_stepping_port;
1387 rc = etr_register_port(&etr_port0_dev); 1388 rc = etr_register_port(&etr_port0_dev);
@@ -1395,11 +1396,11 @@ static int __init etr_init_sysfs(void)
1395out_remove_port0: 1396out_remove_port0:
1396 etr_unregister_port(&etr_port0_dev); 1397 etr_unregister_port(&etr_port0_dev);
1397out_remove_stepping_mode: 1398out_remove_stepping_mode:
1398 sysdev_class_remove_file(&etr_sysclass, &attr_stepping_mode); 1399 device_remove_file(etr_subsys.dev_root, &dev_attr_stepping_mode);
1399out_remove_stepping_port: 1400out_remove_stepping_port:
1400 sysdev_class_remove_file(&etr_sysclass, &attr_stepping_port); 1401 device_remove_file(etr_subsys.dev_root, &dev_attr_stepping_port);
1401out_unreg_class: 1402out_unreg_subsys:
1402 sysdev_class_unregister(&etr_sysclass); 1403 bus_unregister(&etr_subsys);
1403out: 1404out:
1404 return rc; 1405 return rc;
1405} 1406}
@@ -1599,14 +1600,15 @@ out_unlock:
1599} 1600}
1600 1601
1601/* 1602/*
1602 * STP class sysfs interface functions 1603 * STP subsys sysfs interface functions
1603 */ 1604 */
1604static struct sysdev_class stp_sysclass = { 1605static struct bus_type stp_subsys = {
1605 .name = "stp", 1606 .name = "stp",
1607 .dev_name = "stp",
1606}; 1608};
1607 1609
1608static ssize_t stp_ctn_id_show(struct sysdev_class *class, 1610static ssize_t stp_ctn_id_show(struct device *dev,
1609 struct sysdev_class_attribute *attr, 1611 struct device_attribute *attr,
1610 char *buf) 1612 char *buf)
1611{ 1613{
1612 if (!stp_online) 1614 if (!stp_online)
@@ -1615,10 +1617,10 @@ static ssize_t stp_ctn_id_show(struct sysdev_class *class,
1615 *(unsigned long long *) stp_info.ctnid); 1617 *(unsigned long long *) stp_info.ctnid);
1616} 1618}
1617 1619
1618static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); 1620static DEVICE_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
1619 1621
1620static ssize_t stp_ctn_type_show(struct sysdev_class *class, 1622static ssize_t stp_ctn_type_show(struct device *dev,
1621 struct sysdev_class_attribute *attr, 1623 struct device_attribute *attr,
1622 char *buf) 1624 char *buf)
1623{ 1625{
1624 if (!stp_online) 1626 if (!stp_online)
@@ -1626,10 +1628,10 @@ static ssize_t stp_ctn_type_show(struct sysdev_class *class,
1626 return sprintf(buf, "%i\n", stp_info.ctn); 1628 return sprintf(buf, "%i\n", stp_info.ctn);
1627} 1629}
1628 1630
1629static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); 1631static DEVICE_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
1630 1632
1631static ssize_t stp_dst_offset_show(struct sysdev_class *class, 1633static ssize_t stp_dst_offset_show(struct device *dev,
1632 struct sysdev_class_attribute *attr, 1634 struct device_attribute *attr,
1633 char *buf) 1635 char *buf)
1634{ 1636{
1635 if (!stp_online || !(stp_info.vbits & 0x2000)) 1637 if (!stp_online || !(stp_info.vbits & 0x2000))
@@ -1637,10 +1639,10 @@ static ssize_t stp_dst_offset_show(struct sysdev_class *class,
1637 return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto); 1639 return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto);
1638} 1640}
1639 1641
1640static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); 1642static DEVICE_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
1641 1643
1642static ssize_t stp_leap_seconds_show(struct sysdev_class *class, 1644static ssize_t stp_leap_seconds_show(struct device *dev,
1643 struct sysdev_class_attribute *attr, 1645 struct device_attribute *attr,
1644 char *buf) 1646 char *buf)
1645{ 1647{
1646 if (!stp_online || !(stp_info.vbits & 0x8000)) 1648 if (!stp_online || !(stp_info.vbits & 0x8000))
@@ -1648,10 +1650,10 @@ static ssize_t stp_leap_seconds_show(struct sysdev_class *class,
1648 return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps); 1650 return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps);
1649} 1651}
1650 1652
1651static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); 1653static DEVICE_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
1652 1654
1653static ssize_t stp_stratum_show(struct sysdev_class *class, 1655static ssize_t stp_stratum_show(struct device *dev,
1654 struct sysdev_class_attribute *attr, 1656 struct device_attribute *attr,
1655 char *buf) 1657 char *buf)
1656{ 1658{
1657 if (!stp_online) 1659 if (!stp_online)
@@ -1659,10 +1661,10 @@ static ssize_t stp_stratum_show(struct sysdev_class *class,
1659 return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum); 1661 return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum);
1660} 1662}
1661 1663
1662static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); 1664static DEVICE_ATTR(stratum, 0400, stp_stratum_show, NULL);
1663 1665
1664static ssize_t stp_time_offset_show(struct sysdev_class *class, 1666static ssize_t stp_time_offset_show(struct device *dev,
1665 struct sysdev_class_attribute *attr, 1667 struct device_attribute *attr,
1666 char *buf) 1668 char *buf)
1667{ 1669{
1668 if (!stp_online || !(stp_info.vbits & 0x0800)) 1670 if (!stp_online || !(stp_info.vbits & 0x0800))
@@ -1670,10 +1672,10 @@ static ssize_t stp_time_offset_show(struct sysdev_class *class,
1670 return sprintf(buf, "%i\n", (int) stp_info.tto); 1672 return sprintf(buf, "%i\n", (int) stp_info.tto);
1671} 1673}
1672 1674
1673static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); 1675static DEVICE_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
1674 1676
1675static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, 1677static ssize_t stp_time_zone_offset_show(struct device *dev,
1676 struct sysdev_class_attribute *attr, 1678 struct device_attribute *attr,
1677 char *buf) 1679 char *buf)
1678{ 1680{
1679 if (!stp_online || !(stp_info.vbits & 0x4000)) 1681 if (!stp_online || !(stp_info.vbits & 0x4000))
@@ -1681,11 +1683,11 @@ static ssize_t stp_time_zone_offset_show(struct sysdev_class *class,
1681 return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo); 1683 return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo);
1682} 1684}
1683 1685
1684static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, 1686static DEVICE_ATTR(time_zone_offset, 0400,
1685 stp_time_zone_offset_show, NULL); 1687 stp_time_zone_offset_show, NULL);
1686 1688
1687static ssize_t stp_timing_mode_show(struct sysdev_class *class, 1689static ssize_t stp_timing_mode_show(struct device *dev,
1688 struct sysdev_class_attribute *attr, 1690 struct device_attribute *attr,
1689 char *buf) 1691 char *buf)
1690{ 1692{
1691 if (!stp_online) 1693 if (!stp_online)
@@ -1693,10 +1695,10 @@ static ssize_t stp_timing_mode_show(struct sysdev_class *class,
1693 return sprintf(buf, "%i\n", stp_info.tmd); 1695 return sprintf(buf, "%i\n", stp_info.tmd);
1694} 1696}
1695 1697
1696static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); 1698static DEVICE_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
1697 1699
1698static ssize_t stp_timing_state_show(struct sysdev_class *class, 1700static ssize_t stp_timing_state_show(struct device *dev,
1699 struct sysdev_class_attribute *attr, 1701 struct device_attribute *attr,
1700 char *buf) 1702 char *buf)
1701{ 1703{
1702 if (!stp_online) 1704 if (!stp_online)
@@ -1704,17 +1706,17 @@ static ssize_t stp_timing_state_show(struct sysdev_class *class,
1704 return sprintf(buf, "%i\n", stp_info.tst); 1706 return sprintf(buf, "%i\n", stp_info.tst);
1705} 1707}
1706 1708
1707static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); 1709static DEVICE_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
1708 1710
1709static ssize_t stp_online_show(struct sysdev_class *class, 1711static ssize_t stp_online_show(struct device *dev,
1710 struct sysdev_class_attribute *attr, 1712 struct device_attribute *attr,
1711 char *buf) 1713 char *buf)
1712{ 1714{
1713 return sprintf(buf, "%i\n", stp_online); 1715 return sprintf(buf, "%i\n", stp_online);
1714} 1716}
1715 1717
1716static ssize_t stp_online_store(struct sysdev_class *class, 1718static ssize_t stp_online_store(struct device *dev,
1717 struct sysdev_class_attribute *attr, 1719 struct device_attribute *attr,
1718 const char *buf, size_t count) 1720 const char *buf, size_t count)
1719{ 1721{
1720 unsigned int value; 1722 unsigned int value;
@@ -1736,47 +1738,47 @@ static ssize_t stp_online_store(struct sysdev_class *class,
1736} 1738}
1737 1739
1738/* 1740/*
1739 * Can't use SYSDEV_CLASS_ATTR because the attribute should be named 1741 * Can't use DEVICE_ATTR because the attribute should be named
1740 * stp/online but attr_online already exists in this file .. 1742 * stp/online but dev_attr_online already exists in this file ..
1741 */ 1743 */
1742static struct sysdev_class_attribute attr_stp_online = { 1744static struct device_attribute dev_attr_stp_online = {
1743 .attr = { .name = "online", .mode = 0600 }, 1745 .attr = { .name = "online", .mode = 0600 },
1744 .show = stp_online_show, 1746 .show = stp_online_show,
1745 .store = stp_online_store, 1747 .store = stp_online_store,
1746}; 1748};
1747 1749
1748static struct sysdev_class_attribute *stp_attributes[] = { 1750static struct device_attribute *stp_attributes[] = {
1749 &attr_ctn_id, 1751 &dev_attr_ctn_id,
1750 &attr_ctn_type, 1752 &dev_attr_ctn_type,
1751 &attr_dst_offset, 1753 &dev_attr_dst_offset,
1752 &attr_leap_seconds, 1754 &dev_attr_leap_seconds,
1753 &attr_stp_online, 1755 &dev_attr_stp_online,
1754 &attr_stratum, 1756 &dev_attr_stratum,
1755 &attr_time_offset, 1757 &dev_attr_time_offset,
1756 &attr_time_zone_offset, 1758 &dev_attr_time_zone_offset,
1757 &attr_timing_mode, 1759 &dev_attr_timing_mode,
1758 &attr_timing_state, 1760 &dev_attr_timing_state,
1759 NULL 1761 NULL
1760}; 1762};
1761 1763
1762static int __init stp_init_sysfs(void) 1764static int __init stp_init_sysfs(void)
1763{ 1765{
1764 struct sysdev_class_attribute **attr; 1766 struct device_attribute **attr;
1765 int rc; 1767 int rc;
1766 1768
1767 rc = sysdev_class_register(&stp_sysclass); 1769 rc = subsys_system_register(&stp_subsys, NULL);
1768 if (rc) 1770 if (rc)
1769 goto out; 1771 goto out;
1770 for (attr = stp_attributes; *attr; attr++) { 1772 for (attr = stp_attributes; *attr; attr++) {
1771 rc = sysdev_class_create_file(&stp_sysclass, *attr); 1773 rc = device_create_file(stp_subsys.dev_root, *attr);
1772 if (rc) 1774 if (rc)
1773 goto out_unreg; 1775 goto out_unreg;
1774 } 1776 }
1775 return 0; 1777 return 0;
1776out_unreg: 1778out_unreg:
1777 for (; attr >= stp_attributes; attr--) 1779 for (; attr >= stp_attributes; attr--)
1778 sysdev_class_remove_file(&stp_sysclass, *attr); 1780 device_remove_file(stp_subsys.dev_root, *attr);
1779 sysdev_class_unregister(&stp_sysclass); 1781 bus_unregister(&stp_subsys);
1780out: 1782out:
1781 return rc; 1783 return rc;
1782} 1784}
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index fdb5b8cb260f..6e0e29b29a7b 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -261,7 +261,7 @@ void store_topology(struct sysinfo_15_1_x *info)
261int arch_update_cpu_topology(void) 261int arch_update_cpu_topology(void)
262{ 262{
263 struct sysinfo_15_1_x *info = tl_info; 263 struct sysinfo_15_1_x *info = tl_info;
264 struct sys_device *sysdev; 264 struct device *dev;
265 int cpu; 265 int cpu;
266 266
267 if (!MACHINE_HAS_TOPOLOGY) { 267 if (!MACHINE_HAS_TOPOLOGY) {
@@ -273,8 +273,8 @@ int arch_update_cpu_topology(void)
273 tl_to_cores(info); 273 tl_to_cores(info);
274 update_cpu_core_map(); 274 update_cpu_core_map();
275 for_each_online_cpu(cpu) { 275 for_each_online_cpu(cpu) {
276 sysdev = get_cpu_sysdev(cpu); 276 dev = get_cpu_device(cpu);
277 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 277 kobject_uevent(&dev->kobj, KOBJ_CHANGE);
278 } 278 }
279 return 1; 279 return 1;
280} 280}
diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c
index 83cc704770d7..b1cb2715ad6e 100644
--- a/arch/sh/drivers/dma/dma-sysfs.c
+++ b/arch/sh/drivers/dma/dma-sysfs.c
@@ -12,18 +12,19 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/stat.h> 14#include <linux/stat.h>
15#include <linux/sysdev.h> 15#include <linux/device.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/string.h> 18#include <linux/string.h>
19#include <asm/dma.h> 19#include <asm/dma.h>
20 20
21static struct sysdev_class dma_sysclass = { 21static struct bus_type dma_subsys = {
22 .name = "dma", 22 .name = "dma",
23 .dev_name = "dma",
23}; 24};
24 25
25static ssize_t dma_show_devices(struct sys_device *dev, 26static ssize_t dma_show_devices(struct device *dev,
26 struct sysdev_attribute *attr, char *buf) 27 struct device_attribute *attr, char *buf)
27{ 28{
28 ssize_t len = 0; 29 ssize_t len = 0;
29 int i; 30 int i;
@@ -43,29 +44,29 @@ static ssize_t dma_show_devices(struct sys_device *dev,
43 return len; 44 return len;
44} 45}
45 46
46static SYSDEV_ATTR(devices, S_IRUGO, dma_show_devices, NULL); 47static DEVICE_ATTR(devices, S_IRUGO, dma_show_devices, NULL);
47 48
48static int __init dma_sysclass_init(void) 49static int __init dma_subsys_init(void)
49{ 50{
50 int ret; 51 int ret;
51 52
52 ret = sysdev_class_register(&dma_sysclass); 53 ret = subsys_system_register(&dma_subsys, NULL);
53 if (unlikely(ret)) 54 if (unlikely(ret))
54 return ret; 55 return ret;
55 56
56 return sysfs_create_file(&dma_sysclass.kset.kobj, &attr_devices.attr); 57 return device_create_file(dma_subsys.dev_root, &dev_attr_devices.attr);
57} 58}
58postcore_initcall(dma_sysclass_init); 59postcore_initcall(dma_subsys_init);
59 60
60static ssize_t dma_show_dev_id(struct sys_device *dev, 61static ssize_t dma_show_dev_id(struct device *dev,
61 struct sysdev_attribute *attr, char *buf) 62 struct device_attribute *attr, char *buf)
62{ 63{
63 struct dma_channel *channel = to_dma_channel(dev); 64 struct dma_channel *channel = to_dma_channel(dev);
64 return sprintf(buf, "%s\n", channel->dev_id); 65 return sprintf(buf, "%s\n", channel->dev_id);
65} 66}
66 67
67static ssize_t dma_store_dev_id(struct sys_device *dev, 68static ssize_t dma_store_dev_id(struct device *dev,
68 struct sysdev_attribute *attr, 69 struct device_attribute *attr,
69 const char *buf, size_t count) 70 const char *buf, size_t count)
70{ 71{
71 struct dma_channel *channel = to_dma_channel(dev); 72 struct dma_channel *channel = to_dma_channel(dev);
@@ -73,10 +74,10 @@ static ssize_t dma_store_dev_id(struct sys_device *dev,
73 return count; 74 return count;
74} 75}
75 76
76static SYSDEV_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); 77static DEVICE_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id);
77 78
78static ssize_t dma_store_config(struct sys_device *dev, 79static ssize_t dma_store_config(struct device *dev,
79 struct sysdev_attribute *attr, 80 struct device_attribute *attr,
80 const char *buf, size_t count) 81 const char *buf, size_t count)
81{ 82{
82 struct dma_channel *channel = to_dma_channel(dev); 83 struct dma_channel *channel = to_dma_channel(dev);
@@ -88,17 +89,17 @@ static ssize_t dma_store_config(struct sys_device *dev,
88 return count; 89 return count;
89} 90}
90 91
91static SYSDEV_ATTR(config, S_IWUSR, NULL, dma_store_config); 92static DEVICE_ATTR(config, S_IWUSR, NULL, dma_store_config);
92 93
93static ssize_t dma_show_mode(struct sys_device *dev, 94static ssize_t dma_show_mode(struct device *dev,
94 struct sysdev_attribute *attr, char *buf) 95 struct device_attribute *attr, char *buf)
95{ 96{
96 struct dma_channel *channel = to_dma_channel(dev); 97 struct dma_channel *channel = to_dma_channel(dev);
97 return sprintf(buf, "0x%08x\n", channel->mode); 98 return sprintf(buf, "0x%08x\n", channel->mode);
98} 99}
99 100
100static ssize_t dma_store_mode(struct sys_device *dev, 101static ssize_t dma_store_mode(struct device *dev,
101 struct sysdev_attribute *attr, 102 struct device_attribute *attr,
102 const char *buf, size_t count) 103 const char *buf, size_t count)
103{ 104{
104 struct dma_channel *channel = to_dma_channel(dev); 105 struct dma_channel *channel = to_dma_channel(dev);
@@ -106,38 +107,38 @@ static ssize_t dma_store_mode(struct sys_device *dev,
106 return count; 107 return count;
107} 108}
108 109
109static SYSDEV_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); 110static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode);
110 111
111#define dma_ro_attr(field, fmt) \ 112#define dma_ro_attr(field, fmt) \
112static ssize_t dma_show_##field(struct sys_device *dev, \ 113static ssize_t dma_show_##field(struct device *dev, \
113 struct sysdev_attribute *attr, char *buf)\ 114 struct device_attribute *attr, char *buf)\
114{ \ 115{ \
115 struct dma_channel *channel = to_dma_channel(dev); \ 116 struct dma_channel *channel = to_dma_channel(dev); \
116 return sprintf(buf, fmt, channel->field); \ 117 return sprintf(buf, fmt, channel->field); \
117} \ 118} \
118static SYSDEV_ATTR(field, S_IRUGO, dma_show_##field, NULL); 119static DEVICE_ATTR(field, S_IRUGO, dma_show_##field, NULL);
119 120
120dma_ro_attr(count, "0x%08x\n"); 121dma_ro_attr(count, "0x%08x\n");
121dma_ro_attr(flags, "0x%08lx\n"); 122dma_ro_attr(flags, "0x%08lx\n");
122 123
123int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info) 124int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info)
124{ 125{
125 struct sys_device *dev = &chan->dev; 126 struct device *dev = &chan->dev;
126 char name[16]; 127 char name[16];
127 int ret; 128 int ret;
128 129
129 dev->id = chan->vchan; 130 dev->id = chan->vchan;
130 dev->cls = &dma_sysclass; 131 dev->bus = &dma_subsys;
131 132
132 ret = sysdev_register(dev); 133 ret = device_register(dev);
133 if (ret) 134 if (ret)
134 return ret; 135 return ret;
135 136
136 ret |= sysdev_create_file(dev, &attr_dev_id); 137 ret |= device_create_file(dev, &dev_attr_dev_id);
137 ret |= sysdev_create_file(dev, &attr_count); 138 ret |= device_create_file(dev, &dev_attr_count);
138 ret |= sysdev_create_file(dev, &attr_mode); 139 ret |= device_create_file(dev, &dev_attr_mode);
139 ret |= sysdev_create_file(dev, &attr_flags); 140 ret |= device_create_file(dev, &dev_attr_flags);
140 ret |= sysdev_create_file(dev, &attr_config); 141 ret |= device_create_file(dev, &dev_attr_config);
141 142
142 if (unlikely(ret)) { 143 if (unlikely(ret)) {
143 dev_err(&info->pdev->dev, "Failed creating attrs\n"); 144 dev_err(&info->pdev->dev, "Failed creating attrs\n");
@@ -150,17 +151,17 @@ int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info)
150 151
151void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info) 152void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info)
152{ 153{
153 struct sys_device *dev = &chan->dev; 154 struct device *dev = &chan->dev;
154 char name[16]; 155 char name[16];
155 156
156 sysdev_remove_file(dev, &attr_dev_id); 157 device_remove_file(dev, &dev_attr_dev_id);
157 sysdev_remove_file(dev, &attr_count); 158 device_remove_file(dev, &dev_attr_count);
158 sysdev_remove_file(dev, &attr_mode); 159 device_remove_file(dev, &dev_attr_mode);
159 sysdev_remove_file(dev, &attr_flags); 160 device_remove_file(dev, &dev_attr_flags);
160 sysdev_remove_file(dev, &attr_config); 161 device_remove_file(dev, &dev_attr_config);
161 162
162 snprintf(name, sizeof(name), "dma%d", chan->chan); 163 snprintf(name, sizeof(name), "dma%d", chan->chan);
163 sysfs_remove_link(&info->pdev->dev.kobj, name); 164 sysfs_remove_link(&info->pdev->dev.kobj, name);
164 165
165 sysdev_unregister(dev); 166 device_unregister(dev);
166} 167}
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
index 07373a074090..6aa2080c0065 100644
--- a/arch/sh/include/asm/dma.h
+++ b/arch/sh/include/asm/dma.h
@@ -14,7 +14,7 @@
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/wait.h> 15#include <linux/wait.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <cpu/dma.h> 18#include <cpu/dma.h>
19#include <asm-generic/dma.h> 19#include <asm-generic/dma.h>
20 20
@@ -91,7 +91,7 @@ struct dma_channel {
91 91
92 wait_queue_head_t wait_queue; 92 wait_queue_head_t wait_queue;
93 93
94 struct sys_device dev; 94 struct device dev;
95 void *priv_data; 95 void *priv_data;
96}; 96};
97 97
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index f0907995b4c9..a8140f0bbf6c 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/cpu.h> 14#include <linux/cpu.h>
15#include <linux/bitmap.h> 15#include <linux/bitmap.h>
16#include <linux/sysdev.h> 16#include <linux/device.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
@@ -337,9 +337,9 @@ static struct kobj_type ktype_percpu_entry = {
337 .default_attrs = sq_sysfs_attrs, 337 .default_attrs = sq_sysfs_attrs,
338}; 338};
339 339
340static int __devinit sq_sysdev_add(struct sys_device *sysdev) 340static int __devinit sq_dev_add(struct device *dev)
341{ 341{
342 unsigned int cpu = sysdev->id; 342 unsigned int cpu = dev->id;
343 struct kobject *kobj; 343 struct kobject *kobj;
344 int error; 344 int error;
345 345
@@ -348,25 +348,27 @@ static int __devinit sq_sysdev_add(struct sys_device *sysdev)
348 return -ENOMEM; 348 return -ENOMEM;
349 349
350 kobj = sq_kobject[cpu]; 350 kobj = sq_kobject[cpu];
351 error = kobject_init_and_add(kobj, &ktype_percpu_entry, &sysdev->kobj, 351 error = kobject_init_and_add(kobj, &ktype_percpu_entry, &dev->kobj,
352 "%s", "sq"); 352 "%s", "sq");
353 if (!error) 353 if (!error)
354 kobject_uevent(kobj, KOBJ_ADD); 354 kobject_uevent(kobj, KOBJ_ADD);
355 return error; 355 return error;
356} 356}
357 357
358static int __devexit sq_sysdev_remove(struct sys_device *sysdev) 358static int __devexit sq_dev_remove(struct device *dev)
359{ 359{
360 unsigned int cpu = sysdev->id; 360 unsigned int cpu = dev->id;
361 struct kobject *kobj = sq_kobject[cpu]; 361 struct kobject *kobj = sq_kobject[cpu];
362 362
363 kobject_put(kobj); 363 kobject_put(kobj);
364 return 0; 364 return 0;
365} 365}
366 366
367static struct sysdev_driver sq_sysdev_driver = { 367static struct subsys_interface sq_interface = {
368 .add = sq_sysdev_add, 368 .name = "sq"
369 .remove = __devexit_p(sq_sysdev_remove), 369 .subsys = &cpu_subsys,
370 .add_dev = sq_dev_add,
371 .remove_dev = __devexit_p(sq_dev_remove),
370}; 372};
371 373
372static int __init sq_api_init(void) 374static int __init sq_api_init(void)
@@ -386,7 +388,7 @@ static int __init sq_api_init(void)
386 if (unlikely(!sq_bitmap)) 388 if (unlikely(!sq_bitmap))
387 goto out; 389 goto out;
388 390
389 ret = sysdev_driver_register(&cpu_sysdev_class, &sq_sysdev_driver); 391 ret = subsys_interface_register(&sq_interface);
390 if (unlikely(ret != 0)) 392 if (unlikely(ret != 0))
391 goto out; 393 goto out;
392 394
@@ -401,7 +403,7 @@ out:
401 403
402static void __exit sq_api_exit(void) 404static void __exit sq_api_exit(void)
403{ 405{
404 sysdev_driver_unregister(&cpu_sysdev_class, &sq_sysdev_driver); 406 subsys_interface_unregister(&sq_interface);
405 kfree(sq_bitmap); 407 kfree(sq_bitmap);
406 kmem_cache_destroy(sq_cache); 408 kmem_cache_destroy(sq_cache);
407} 409}
diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index 7408201d7efb..654e8aad3bbe 100644
--- a/arch/sparc/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -3,7 +3,7 @@
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */ 4 */
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/sysdev.h> 6#include <linux/device.h>
7#include <linux/cpu.h> 7#include <linux/cpu.h>
8#include <linux/smp.h> 8#include <linux/smp.h>
9#include <linux/percpu.h> 9#include <linux/percpu.h>
@@ -16,13 +16,13 @@
16static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64))); 16static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64)));
17 17
18#define SHOW_MMUSTAT_ULONG(NAME) \ 18#define SHOW_MMUSTAT_ULONG(NAME) \
19static ssize_t show_##NAME(struct sys_device *dev, \ 19static ssize_t show_##NAME(struct device *dev, \
20 struct sysdev_attribute *attr, char *buf) \ 20 struct device_attribute *attr, char *buf) \
21{ \ 21{ \
22 struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \ 22 struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \
23 return sprintf(buf, "%lu\n", p->NAME); \ 23 return sprintf(buf, "%lu\n", p->NAME); \
24} \ 24} \
25static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL) 25static DEVICE_ATTR(NAME, 0444, show_##NAME, NULL)
26 26
27SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte); 27SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte);
28SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte); 28SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte);
@@ -58,38 +58,38 @@ SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_256mb_tte);
58SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte); 58SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte);
59 59
60static struct attribute *mmu_stat_attrs[] = { 60static struct attribute *mmu_stat_attrs[] = {
61 &attr_immu_tsb_hits_ctx0_8k_tte.attr, 61 &dev_attr_immu_tsb_hits_ctx0_8k_tte.attr,
62 &attr_immu_tsb_ticks_ctx0_8k_tte.attr, 62 &dev_attr_immu_tsb_ticks_ctx0_8k_tte.attr,
63 &attr_immu_tsb_hits_ctx0_64k_tte.attr, 63 &dev_attr_immu_tsb_hits_ctx0_64k_tte.attr,
64 &attr_immu_tsb_ticks_ctx0_64k_tte.attr, 64 &dev_attr_immu_tsb_ticks_ctx0_64k_tte.attr,
65 &attr_immu_tsb_hits_ctx0_4mb_tte.attr, 65 &dev_attr_immu_tsb_hits_ctx0_4mb_tte.attr,
66 &attr_immu_tsb_ticks_ctx0_4mb_tte.attr, 66 &dev_attr_immu_tsb_ticks_ctx0_4mb_tte.attr,
67 &attr_immu_tsb_hits_ctx0_256mb_tte.attr, 67 &dev_attr_immu_tsb_hits_ctx0_256mb_tte.attr,
68 &attr_immu_tsb_ticks_ctx0_256mb_tte.attr, 68 &dev_attr_immu_tsb_ticks_ctx0_256mb_tte.attr,
69 &attr_immu_tsb_hits_ctxnon0_8k_tte.attr, 69 &dev_attr_immu_tsb_hits_ctxnon0_8k_tte.attr,
70 &attr_immu_tsb_ticks_ctxnon0_8k_tte.attr, 70 &dev_attr_immu_tsb_ticks_ctxnon0_8k_tte.attr,
71 &attr_immu_tsb_hits_ctxnon0_64k_tte.attr, 71 &dev_attr_immu_tsb_hits_ctxnon0_64k_tte.attr,
72 &attr_immu_tsb_ticks_ctxnon0_64k_tte.attr, 72 &dev_attr_immu_tsb_ticks_ctxnon0_64k_tte.attr,
73 &attr_immu_tsb_hits_ctxnon0_4mb_tte.attr, 73 &dev_attr_immu_tsb_hits_ctxnon0_4mb_tte.attr,
74 &attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr, 74 &dev_attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr,
75 &attr_immu_tsb_hits_ctxnon0_256mb_tte.attr, 75 &dev_attr_immu_tsb_hits_ctxnon0_256mb_tte.attr,
76 &attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr, 76 &dev_attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr,
77 &attr_dmmu_tsb_hits_ctx0_8k_tte.attr, 77 &dev_attr_dmmu_tsb_hits_ctx0_8k_tte.attr,
78 &attr_dmmu_tsb_ticks_ctx0_8k_tte.attr, 78 &dev_attr_dmmu_tsb_ticks_ctx0_8k_tte.attr,
79 &attr_dmmu_tsb_hits_ctx0_64k_tte.attr, 79 &dev_attr_dmmu_tsb_hits_ctx0_64k_tte.attr,
80 &attr_dmmu_tsb_ticks_ctx0_64k_tte.attr, 80 &dev_attr_dmmu_tsb_ticks_ctx0_64k_tte.attr,
81 &attr_dmmu_tsb_hits_ctx0_4mb_tte.attr, 81 &dev_attr_dmmu_tsb_hits_ctx0_4mb_tte.attr,
82 &attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr, 82 &dev_attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr,
83 &attr_dmmu_tsb_hits_ctx0_256mb_tte.attr, 83 &dev_attr_dmmu_tsb_hits_ctx0_256mb_tte.attr,
84 &attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr, 84 &dev_attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr,
85 &attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr, 85 &dev_attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr,
86 &attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr, 86 &dev_attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr,
87 &attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr, 87 &dev_attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr,
88 &attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr, 88 &dev_attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr,
89 &attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr, 89 &dev_attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr,
90 &attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr, 90 &dev_attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr,
91 &attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr, 91 &dev_attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr,
92 &attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr, 92 &dev_attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr,
93 NULL, 93 NULL,
94}; 94};
95 95
@@ -139,15 +139,15 @@ static unsigned long write_mmustat_enable(unsigned long val)
139 return sun4v_mmustat_conf(ra, &orig_ra); 139 return sun4v_mmustat_conf(ra, &orig_ra);
140} 140}
141 141
142static ssize_t show_mmustat_enable(struct sys_device *s, 142static ssize_t show_mmustat_enable(struct device *s,
143 struct sysdev_attribute *attr, char *buf) 143 struct device_attribute *attr, char *buf)
144{ 144{
145 unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0); 145 unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0);
146 return sprintf(buf, "%lx\n", val); 146 return sprintf(buf, "%lx\n", val);
147} 147}
148 148
149static ssize_t store_mmustat_enable(struct sys_device *s, 149static ssize_t store_mmustat_enable(struct device *s,
150 struct sysdev_attribute *attr, const char *buf, 150 struct device_attribute *attr, const char *buf,
151 size_t count) 151 size_t count)
152{ 152{
153 unsigned long val, err; 153 unsigned long val, err;
@@ -163,39 +163,39 @@ static ssize_t store_mmustat_enable(struct sys_device *s,
163 return count; 163 return count;
164} 164}
165 165
166static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable); 166static DEVICE_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable);
167 167
168static int mmu_stats_supported; 168static int mmu_stats_supported;
169 169
170static int register_mmu_stats(struct sys_device *s) 170static int register_mmu_stats(struct device *s)
171{ 171{
172 if (!mmu_stats_supported) 172 if (!mmu_stats_supported)
173 return 0; 173 return 0;
174 sysdev_create_file(s, &attr_mmustat_enable); 174 device_create_file(s, &dev_attr_mmustat_enable);
175 return sysfs_create_group(&s->kobj, &mmu_stat_group); 175 return sysfs_create_group(&s->kobj, &mmu_stat_group);
176} 176}
177 177
178#ifdef CONFIG_HOTPLUG_CPU 178#ifdef CONFIG_HOTPLUG_CPU
179static void unregister_mmu_stats(struct sys_device *s) 179static void unregister_mmu_stats(struct device *s)
180{ 180{
181 if (!mmu_stats_supported) 181 if (!mmu_stats_supported)
182 return; 182 return;
183 sysfs_remove_group(&s->kobj, &mmu_stat_group); 183 sysfs_remove_group(&s->kobj, &mmu_stat_group);
184 sysdev_remove_file(s, &attr_mmustat_enable); 184 device_remove_file(s, &dev_attr_mmustat_enable);
185} 185}
186#endif 186#endif
187 187
188#define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ 188#define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \
189static ssize_t show_##NAME(struct sys_device *dev, \ 189static ssize_t show_##NAME(struct device *dev, \
190 struct sysdev_attribute *attr, char *buf) \ 190 struct device_attribute *attr, char *buf) \
191{ \ 191{ \
192 cpuinfo_sparc *c = &cpu_data(dev->id); \ 192 cpuinfo_sparc *c = &cpu_data(dev->id); \
193 return sprintf(buf, "%lu\n", c->MEMBER); \ 193 return sprintf(buf, "%lu\n", c->MEMBER); \
194} 194}
195 195
196#define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ 196#define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \
197static ssize_t show_##NAME(struct sys_device *dev, \ 197static ssize_t show_##NAME(struct device *dev, \
198 struct sysdev_attribute *attr, char *buf) \ 198 struct device_attribute *attr, char *buf) \
199{ \ 199{ \
200 cpuinfo_sparc *c = &cpu_data(dev->id); \ 200 cpuinfo_sparc *c = &cpu_data(dev->id); \
201 return sprintf(buf, "%u\n", c->MEMBER); \ 201 return sprintf(buf, "%u\n", c->MEMBER); \
@@ -209,14 +209,14 @@ SHOW_CPUDATA_UINT_NAME(l1_icache_line_size, icache_line_size);
209SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size); 209SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size);
210SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size); 210SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size);
211 211
212static struct sysdev_attribute cpu_core_attrs[] = { 212static struct device_attribute cpu_core_attrs[] = {
213 _SYSDEV_ATTR(clock_tick, 0444, show_clock_tick, NULL), 213 __ATTR(clock_tick, 0444, show_clock_tick, NULL),
214 _SYSDEV_ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL), 214 __ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL),
215 _SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL), 215 __ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL),
216 _SYSDEV_ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL), 216 __ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL),
217 _SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL), 217 __ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL),
218 _SYSDEV_ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL), 218 __ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL),
219 _SYSDEV_ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL), 219 __ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL),
220}; 220};
221 221
222static DEFINE_PER_CPU(struct cpu, cpu_devices); 222static DEFINE_PER_CPU(struct cpu, cpu_devices);
@@ -224,11 +224,11 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
224static void register_cpu_online(unsigned int cpu) 224static void register_cpu_online(unsigned int cpu)
225{ 225{
226 struct cpu *c = &per_cpu(cpu_devices, cpu); 226 struct cpu *c = &per_cpu(cpu_devices, cpu);
227 struct sys_device *s = &c->sysdev; 227 struct device *s = &c->dev;
228 int i; 228 int i;
229 229
230 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) 230 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
231 sysdev_create_file(s, &cpu_core_attrs[i]); 231 device_create_file(s, &cpu_core_attrs[i]);
232 232
233 register_mmu_stats(s); 233 register_mmu_stats(s);
234} 234}
@@ -237,12 +237,12 @@ static void register_cpu_online(unsigned int cpu)
237static void unregister_cpu_online(unsigned int cpu) 237static void unregister_cpu_online(unsigned int cpu)
238{ 238{
239 struct cpu *c = &per_cpu(cpu_devices, cpu); 239 struct cpu *c = &per_cpu(cpu_devices, cpu);
240 struct sys_device *s = &c->sysdev; 240 struct device *s = &c->dev;
241 int i; 241 int i;
242 242
243 unregister_mmu_stats(s); 243 unregister_mmu_stats(s);
244 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) 244 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
245 sysdev_remove_file(s, &cpu_core_attrs[i]); 245 device_remove_file(s, &cpu_core_attrs[i]);
246} 246}
247#endif 247#endif
248 248
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
index 602908268093..f862b005eb73 100644
--- a/arch/tile/kernel/sysfs.c
+++ b/arch/tile/kernel/sysfs.c
@@ -14,7 +14,7 @@
14 * /sys entry support. 14 * /sys entry support.
15 */ 15 */
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/cpu.h> 18#include <linux/cpu.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/smp.h> 20#include <linux/smp.h>
@@ -32,55 +32,55 @@ static ssize_t get_hv_confstr(char *page, int query)
32 return n; 32 return n;
33} 33}
34 34
35static ssize_t chip_width_show(struct sysdev_class *dev, 35static ssize_t chip_width_show(struct device *dev,
36 struct sysdev_class_attribute *attr, 36 struct device_attribute *attr,
37 char *page) 37 char *page)
38{ 38{
39 return sprintf(page, "%u\n", smp_width); 39 return sprintf(page, "%u\n", smp_width);
40} 40}
41static SYSDEV_CLASS_ATTR(chip_width, 0444, chip_width_show, NULL); 41static DEVICE_ATTR(chip_width, 0444, chip_width_show, NULL);
42 42
43static ssize_t chip_height_show(struct sysdev_class *dev, 43static ssize_t chip_height_show(struct device *dev,
44 struct sysdev_class_attribute *attr, 44 struct device_attribute *attr,
45 char *page) 45 char *page)
46{ 46{
47 return sprintf(page, "%u\n", smp_height); 47 return sprintf(page, "%u\n", smp_height);
48} 48}
49static SYSDEV_CLASS_ATTR(chip_height, 0444, chip_height_show, NULL); 49static DEVICE_ATTR(chip_height, 0444, chip_height_show, NULL);
50 50
51static ssize_t chip_serial_show(struct sysdev_class *dev, 51static ssize_t chip_serial_show(struct device *dev,
52 struct sysdev_class_attribute *attr, 52 struct device_attribute *attr,
53 char *page) 53 char *page)
54{ 54{
55 return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM); 55 return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM);
56} 56}
57static SYSDEV_CLASS_ATTR(chip_serial, 0444, chip_serial_show, NULL); 57static DEVICE_ATTR(chip_serial, 0444, chip_serial_show, NULL);
58 58
59static ssize_t chip_revision_show(struct sysdev_class *dev, 59static ssize_t chip_revision_show(struct device *dev,
60 struct sysdev_class_attribute *attr, 60 struct device_attribute *attr,
61 char *page) 61 char *page)
62{ 62{
63 return get_hv_confstr(page, HV_CONFSTR_CHIP_REV); 63 return get_hv_confstr(page, HV_CONFSTR_CHIP_REV);
64} 64}
65static SYSDEV_CLASS_ATTR(chip_revision, 0444, chip_revision_show, NULL); 65static DEVICE_ATTR(chip_revision, 0444, chip_revision_show, NULL);
66 66
67 67
68static ssize_t type_show(struct sysdev_class *dev, 68static ssize_t type_show(struct device *dev,
69 struct sysdev_class_attribute *attr, 69 struct device_attribute *attr,
70 char *page) 70 char *page)
71{ 71{
72 return sprintf(page, "tilera\n"); 72 return sprintf(page, "tilera\n");
73} 73}
74static SYSDEV_CLASS_ATTR(type, 0444, type_show, NULL); 74static DEVICE_ATTR(type, 0444, type_show, NULL);
75 75
76#define HV_CONF_ATTR(name, conf) \ 76#define HV_CONF_ATTR(name, conf) \
77 static ssize_t name ## _show(struct sysdev_class *dev, \ 77 static ssize_t name ## _show(struct device *dev, \
78 struct sysdev_class_attribute *attr, \ 78 struct device_attribute *attr, \
79 char *page) \ 79 char *page) \
80 { \ 80 { \
81 return get_hv_confstr(page, conf); \ 81 return get_hv_confstr(page, conf); \
82 } \ 82 } \
83 static SYSDEV_CLASS_ATTR(name, 0444, name ## _show, NULL); 83 static DEVICE_ATTR(name, 0444, name ## _show, NULL);
84 84
85HV_CONF_ATTR(version, HV_CONFSTR_HV_SW_VER) 85HV_CONF_ATTR(version, HV_CONFSTR_HV_SW_VER)
86HV_CONF_ATTR(config_version, HV_CONFSTR_HV_CONFIG_VER) 86HV_CONF_ATTR(config_version, HV_CONFSTR_HV_CONFIG_VER)
@@ -96,15 +96,15 @@ HV_CONF_ATTR(mezz_description, HV_CONFSTR_MEZZ_DESC)
96HV_CONF_ATTR(switch_control, HV_CONFSTR_SWITCH_CONTROL) 96HV_CONF_ATTR(switch_control, HV_CONFSTR_SWITCH_CONTROL)
97 97
98static struct attribute *board_attrs[] = { 98static struct attribute *board_attrs[] = {
99 &attr_board_part.attr, 99 &dev_attr_board_part.attr,
100 &attr_board_serial.attr, 100 &dev_attr_board_serial.attr,
101 &attr_board_revision.attr, 101 &dev_attr_board_revision.attr,
102 &attr_board_description.attr, 102 &dev_attr_board_description.attr,
103 &attr_mezz_part.attr, 103 &dev_attr_mezz_part.attr,
104 &attr_mezz_serial.attr, 104 &dev_attr_mezz_serial.attr,
105 &attr_mezz_revision.attr, 105 &dev_attr_mezz_revision.attr,
106 &attr_mezz_description.attr, 106 &dev_attr_mezz_description.attr,
107 &attr_switch_control.attr, 107 &dev_attr_switch_control.attr,
108 NULL 108 NULL
109}; 109};
110 110
@@ -151,12 +151,11 @@ hvconfig_bin_read(struct file *filp, struct kobject *kobj,
151 151
152static int __init create_sysfs_entries(void) 152static int __init create_sysfs_entries(void)
153{ 153{
154 struct sysdev_class *cls = &cpu_sysdev_class;
155 int err = 0; 154 int err = 0;
156 155
157#define create_cpu_attr(name) \ 156#define create_cpu_attr(name) \
158 if (!err) \ 157 if (!err) \
159 err = sysfs_create_file(&cls->kset.kobj, &attr_##name.attr); 158 err = device_create_file(cpu_subsys.dev_root, &dev_attr_##name);
160 create_cpu_attr(chip_width); 159 create_cpu_attr(chip_width);
161 create_cpu_attr(chip_height); 160 create_cpu_attr(chip_height);
162 create_cpu_attr(chip_serial); 161 create_cpu_attr(chip_serial);
@@ -164,7 +163,7 @@ static int __init create_sysfs_entries(void)
164 163
165#define create_hv_attr(name) \ 164#define create_hv_attr(name) \
166 if (!err) \ 165 if (!err) \
167 err = sysfs_create_file(hypervisor_kobj, &attr_##name.attr); 166 err = sysfs_create_file(hypervisor_kobj, &dev_attr_##name);
168 create_hv_attr(type); 167 create_hv_attr(type);
169 create_hv_attr(version); 168 create_hv_attr(version);
170 create_hv_attr(config_version); 169 create_hv_attr(config_version);
diff --git a/arch/unicore32/kernel/puv3-core.c b/arch/unicore32/kernel/puv3-core.c
index 1a505a787765..254adeecc61a 100644
--- a/arch/unicore32/kernel/puv3-core.c
+++ b/arch/unicore32/kernel/puv3-core.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/sysdev.h>
17#include <linux/amba/bus.h> 16#include <linux/amba/bus.h>
18#include <linux/platform_device.h> 17#include <linux/platform_device.h>
19#include <linux/io.h> 18#include <linux/io.h>
diff --git a/arch/unicore32/kernel/puv3-nb0916.c b/arch/unicore32/kernel/puv3-nb0916.c
index e731c561ed4e..37b12a06b499 100644
--- a/arch/unicore32/kernel/puv3-nb0916.c
+++ b/arch/unicore32/kernel/puv3-nb0916.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/sysdev.h>
17#include <linux/platform_device.h> 16#include <linux/platform_device.h>
18#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
19#include <linux/io.h> 18#include <linux/io.h>
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 0e8ae57d3656..7f06a19718a4 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -149,7 +149,7 @@ static inline void enable_p5_mce(void) {}
149 149
150void mce_setup(struct mce *m); 150void mce_setup(struct mce *m);
151void mce_log(struct mce *m); 151void mce_log(struct mce *m);
152DECLARE_PER_CPU(struct sys_device, mce_sysdev); 152DECLARE_PER_CPU(struct device, mce_device);
153 153
154/* 154/*
155 * Maximum banks number. 155 * Maximum banks number.
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index a3b0811693c9..6b45e5e7a901 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -844,8 +844,7 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
844 844
845#include <linux/kobject.h> 845#include <linux/kobject.h>
846#include <linux/sysfs.h> 846#include <linux/sysfs.h>
847 847#include <linux/cpu.h>
848extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */
849 848
850/* pointer to kobject for cpuX/cache */ 849/* pointer to kobject for cpuX/cache */
851static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject); 850static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject);
@@ -1073,9 +1072,9 @@ err_out:
1073static DECLARE_BITMAP(cache_dev_map, NR_CPUS); 1072static DECLARE_BITMAP(cache_dev_map, NR_CPUS);
1074 1073
1075/* Add/Remove cache interface for CPU device */ 1074/* Add/Remove cache interface for CPU device */
1076static int __cpuinit cache_add_dev(struct sys_device * sys_dev) 1075static int __cpuinit cache_add_dev(struct device *dev)
1077{ 1076{
1078 unsigned int cpu = sys_dev->id; 1077 unsigned int cpu = dev->id;
1079 unsigned long i, j; 1078 unsigned long i, j;
1080 struct _index_kobject *this_object; 1079 struct _index_kobject *this_object;
1081 struct _cpuid4_info *this_leaf; 1080 struct _cpuid4_info *this_leaf;
@@ -1087,7 +1086,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
1087 1086
1088 retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu), 1087 retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu),
1089 &ktype_percpu_entry, 1088 &ktype_percpu_entry,
1090 &sys_dev->kobj, "%s", "cache"); 1089 &dev->kobj, "%s", "cache");
1091 if (retval < 0) { 1090 if (retval < 0) {
1092 cpuid4_cache_sysfs_exit(cpu); 1091 cpuid4_cache_sysfs_exit(cpu);
1093 return retval; 1092 return retval;
@@ -1124,9 +1123,9 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
1124 return 0; 1123 return 0;
1125} 1124}
1126 1125
1127static void __cpuinit cache_remove_dev(struct sys_device * sys_dev) 1126static void __cpuinit cache_remove_dev(struct device *dev)
1128{ 1127{
1129 unsigned int cpu = sys_dev->id; 1128 unsigned int cpu = dev->id;
1130 unsigned long i; 1129 unsigned long i;
1131 1130
1132 if (per_cpu(ici_cpuid4_info, cpu) == NULL) 1131 if (per_cpu(ici_cpuid4_info, cpu) == NULL)
@@ -1145,17 +1144,17 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
1145 unsigned long action, void *hcpu) 1144 unsigned long action, void *hcpu)
1146{ 1145{
1147 unsigned int cpu = (unsigned long)hcpu; 1146 unsigned int cpu = (unsigned long)hcpu;
1148 struct sys_device *sys_dev; 1147 struct device *dev;
1149 1148
1150 sys_dev = get_cpu_sysdev(cpu); 1149 dev = get_cpu_device(cpu);
1151 switch (action) { 1150 switch (action) {
1152 case CPU_ONLINE: 1151 case CPU_ONLINE:
1153 case CPU_ONLINE_FROZEN: 1152 case CPU_ONLINE_FROZEN:
1154 cache_add_dev(sys_dev); 1153 cache_add_dev(dev);
1155 break; 1154 break;
1156 case CPU_DEAD: 1155 case CPU_DEAD:
1157 case CPU_DEAD_FROZEN: 1156 case CPU_DEAD_FROZEN:
1158 cache_remove_dev(sys_dev); 1157 cache_remove_dev(dev);
1159 break; 1158 break;
1160 } 1159 }
1161 return NOTIFY_OK; 1160 return NOTIFY_OK;
@@ -1174,9 +1173,9 @@ static int __cpuinit cache_sysfs_init(void)
1174 1173
1175 for_each_online_cpu(i) { 1174 for_each_online_cpu(i) {
1176 int err; 1175 int err;
1177 struct sys_device *sys_dev = get_cpu_sysdev(i); 1176 struct device *dev = get_cpu_device(i);
1178 1177
1179 err = cache_add_dev(sys_dev); 1178 err = cache_add_dev(dev);
1180 if (err) 1179 if (err)
1181 return err; 1180 return err;
1182 } 1181 }
diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
index fefcc69ee8b5..ed44c8a65858 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -1,4 +1,4 @@
1#include <linux/sysdev.h> 1#include <linux/device.h>
2#include <asm/mce.h> 2#include <asm/mce.h>
3 3
4enum severity_level { 4enum severity_level {
@@ -17,7 +17,7 @@ enum severity_level {
17struct mce_bank { 17struct mce_bank {
18 u64 ctl; /* subevents to enable */ 18 u64 ctl; /* subevents to enable */
19 unsigned char init; /* initialise bank? */ 19 unsigned char init; /* initialise bank? */
20 struct sysdev_attribute attr; /* sysdev attribute */ 20 struct device_attribute attr; /* device attribute */
21 char attrname[ATTR_LEN]; /* attribute name */ 21 char attrname[ATTR_LEN]; /* attribute name */
22}; 22};
23 23
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 2af127d4c3d1..c83e3736ce28 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -19,7 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/percpu.h> 20#include <linux/percpu.h>
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/sysdev.h> 22#include <linux/device.h>
23#include <linux/syscore_ops.h> 23#include <linux/syscore_ops.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/ctype.h> 25#include <linux/ctype.h>
@@ -1770,7 +1770,7 @@ static struct syscore_ops mce_syscore_ops = {
1770}; 1770};
1771 1771
1772/* 1772/*
1773 * mce_sysdev: Sysfs support 1773 * mce_device: Sysfs support
1774 */ 1774 */
1775 1775
1776static void mce_cpu_restart(void *data) 1776static void mce_cpu_restart(void *data)
@@ -1806,27 +1806,28 @@ static void mce_enable_ce(void *all)
1806 __mcheck_cpu_init_timer(); 1806 __mcheck_cpu_init_timer();
1807} 1807}
1808 1808
1809static struct sysdev_class mce_sysdev_class = { 1809static struct bus_type mce_subsys = {
1810 .name = "machinecheck", 1810 .name = "machinecheck",
1811 .dev_name = "machinecheck",
1811}; 1812};
1812 1813
1813DEFINE_PER_CPU(struct sys_device, mce_sysdev); 1814DEFINE_PER_CPU(struct device, mce_device);
1814 1815
1815__cpuinitdata 1816__cpuinitdata
1816void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu); 1817void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
1817 1818
1818static inline struct mce_bank *attr_to_bank(struct sysdev_attribute *attr) 1819static inline struct mce_bank *attr_to_bank(struct device_attribute *attr)
1819{ 1820{
1820 return container_of(attr, struct mce_bank, attr); 1821 return container_of(attr, struct mce_bank, attr);
1821} 1822}
1822 1823
1823static ssize_t show_bank(struct sys_device *s, struct sysdev_attribute *attr, 1824static ssize_t show_bank(struct device *s, struct device_attribute *attr,
1824 char *buf) 1825 char *buf)
1825{ 1826{
1826 return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl); 1827 return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl);
1827} 1828}
1828 1829
1829static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr, 1830static ssize_t set_bank(struct device *s, struct device_attribute *attr,
1830 const char *buf, size_t size) 1831 const char *buf, size_t size)
1831{ 1832{
1832 u64 new; 1833 u64 new;
@@ -1841,14 +1842,14 @@ static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr,
1841} 1842}
1842 1843
1843static ssize_t 1844static ssize_t
1844show_trigger(struct sys_device *s, struct sysdev_attribute *attr, char *buf) 1845show_trigger(struct device *s, struct device_attribute *attr, char *buf)
1845{ 1846{
1846 strcpy(buf, mce_helper); 1847 strcpy(buf, mce_helper);
1847 strcat(buf, "\n"); 1848 strcat(buf, "\n");
1848 return strlen(mce_helper) + 1; 1849 return strlen(mce_helper) + 1;
1849} 1850}
1850 1851
1851static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr, 1852static ssize_t set_trigger(struct device *s, struct device_attribute *attr,
1852 const char *buf, size_t siz) 1853 const char *buf, size_t siz)
1853{ 1854{
1854 char *p; 1855 char *p;
@@ -1863,8 +1864,8 @@ static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr,
1863 return strlen(mce_helper) + !!p; 1864 return strlen(mce_helper) + !!p;
1864} 1865}
1865 1866
1866static ssize_t set_ignore_ce(struct sys_device *s, 1867static ssize_t set_ignore_ce(struct device *s,
1867 struct sysdev_attribute *attr, 1868 struct device_attribute *attr,
1868 const char *buf, size_t size) 1869 const char *buf, size_t size)
1869{ 1870{
1870 u64 new; 1871 u64 new;
@@ -1887,8 +1888,8 @@ static ssize_t set_ignore_ce(struct sys_device *s,
1887 return size; 1888 return size;
1888} 1889}
1889 1890
1890static ssize_t set_cmci_disabled(struct sys_device *s, 1891static ssize_t set_cmci_disabled(struct device *s,
1891 struct sysdev_attribute *attr, 1892 struct device_attribute *attr,
1892 const char *buf, size_t size) 1893 const char *buf, size_t size)
1893{ 1894{
1894 u64 new; 1895 u64 new;
@@ -1910,108 +1911,107 @@ static ssize_t set_cmci_disabled(struct sys_device *s,
1910 return size; 1911 return size;
1911} 1912}
1912 1913
1913static ssize_t store_int_with_restart(struct sys_device *s, 1914static ssize_t store_int_with_restart(struct device *s,
1914 struct sysdev_attribute *attr, 1915 struct device_attribute *attr,
1915 const char *buf, size_t size) 1916 const char *buf, size_t size)
1916{ 1917{
1917 ssize_t ret = sysdev_store_int(s, attr, buf, size); 1918 ssize_t ret = device_store_int(s, attr, buf, size);
1918 mce_restart(); 1919 mce_restart();
1919 return ret; 1920 return ret;
1920} 1921}
1921 1922
1922static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); 1923static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger);
1923static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); 1924static DEVICE_INT_ATTR(tolerant, 0644, tolerant);
1924static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); 1925static DEVICE_INT_ATTR(monarch_timeout, 0644, monarch_timeout);
1925static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); 1926static DEVICE_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce);
1926 1927
1927static struct sysdev_ext_attribute attr_check_interval = { 1928static struct dev_ext_attribute dev_attr_check_interval = {
1928 _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int, 1929 __ATTR(check_interval, 0644, device_show_int, store_int_with_restart),
1929 store_int_with_restart),
1930 &check_interval 1930 &check_interval
1931}; 1931};
1932 1932
1933static struct sysdev_ext_attribute attr_ignore_ce = { 1933static struct dev_ext_attribute dev_attr_ignore_ce = {
1934 _SYSDEV_ATTR(ignore_ce, 0644, sysdev_show_int, set_ignore_ce), 1934 __ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce),
1935 &mce_ignore_ce 1935 &mce_ignore_ce
1936}; 1936};
1937 1937
1938static struct sysdev_ext_attribute attr_cmci_disabled = { 1938static struct dev_ext_attribute dev_attr_cmci_disabled = {
1939 _SYSDEV_ATTR(cmci_disabled, 0644, sysdev_show_int, set_cmci_disabled), 1939 __ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled),
1940 &mce_cmci_disabled 1940 &mce_cmci_disabled
1941}; 1941};
1942 1942
1943static struct sysdev_attribute *mce_sysdev_attrs[] = { 1943static struct device_attribute *mce_device_attrs[] = {
1944 &attr_tolerant.attr, 1944 &dev_attr_tolerant.attr,
1945 &attr_check_interval.attr, 1945 &dev_attr_check_interval.attr,
1946 &attr_trigger, 1946 &dev_attr_trigger,
1947 &attr_monarch_timeout.attr, 1947 &dev_attr_monarch_timeout.attr,
1948 &attr_dont_log_ce.attr, 1948 &dev_attr_dont_log_ce.attr,
1949 &attr_ignore_ce.attr, 1949 &dev_attr_ignore_ce.attr,
1950 &attr_cmci_disabled.attr, 1950 &dev_attr_cmci_disabled.attr,
1951 NULL 1951 NULL
1952}; 1952};
1953 1953
1954static cpumask_var_t mce_sysdev_initialized; 1954static cpumask_var_t mce_device_initialized;
1955 1955
1956/* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */ 1956/* Per cpu device init. All of the cpus still share the same ctrl bank: */
1957static __cpuinit int mce_sysdev_create(unsigned int cpu) 1957static __cpuinit int mce_device_create(unsigned int cpu)
1958{ 1958{
1959 struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); 1959 struct device *dev = &per_cpu(mce_device, cpu);
1960 int err; 1960 int err;
1961 int i, j; 1961 int i, j;
1962 1962
1963 if (!mce_available(&boot_cpu_data)) 1963 if (!mce_available(&boot_cpu_data))
1964 return -EIO; 1964 return -EIO;
1965 1965
1966 memset(&sysdev->kobj, 0, sizeof(struct kobject)); 1966 memset(&dev->kobj, 0, sizeof(struct kobject));
1967 sysdev->id = cpu; 1967 dev->id = cpu;
1968 sysdev->cls = &mce_sysdev_class; 1968 dev->bus = &mce_subsys;
1969 1969
1970 err = sysdev_register(sysdev); 1970 err = device_register(dev);
1971 if (err) 1971 if (err)
1972 return err; 1972 return err;
1973 1973
1974 for (i = 0; mce_sysdev_attrs[i]; i++) { 1974 for (i = 0; mce_device_attrs[i]; i++) {
1975 err = sysdev_create_file(sysdev, mce_sysdev_attrs[i]); 1975 err = device_create_file(dev, mce_device_attrs[i]);
1976 if (err) 1976 if (err)
1977 goto error; 1977 goto error;
1978 } 1978 }
1979 for (j = 0; j < banks; j++) { 1979 for (j = 0; j < banks; j++) {
1980 err = sysdev_create_file(sysdev, &mce_banks[j].attr); 1980 err = device_create_file(dev, &mce_banks[j].attr);
1981 if (err) 1981 if (err)
1982 goto error2; 1982 goto error2;
1983 } 1983 }
1984 cpumask_set_cpu(cpu, mce_sysdev_initialized); 1984 cpumask_set_cpu(cpu, mce_device_initialized);
1985 1985
1986 return 0; 1986 return 0;
1987error2: 1987error2:
1988 while (--j >= 0) 1988 while (--j >= 0)
1989 sysdev_remove_file(sysdev, &mce_banks[j].attr); 1989 device_remove_file(dev, &mce_banks[j].attr);
1990error: 1990error:
1991 while (--i >= 0) 1991 while (--i >= 0)
1992 sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); 1992 device_remove_file(dev, mce_device_attrs[i]);
1993 1993
1994 sysdev_unregister(sysdev); 1994 device_unregister(dev);
1995 1995
1996 return err; 1996 return err;
1997} 1997}
1998 1998
1999static __cpuinit void mce_sysdev_remove(unsigned int cpu) 1999static __cpuinit void mce_device_remove(unsigned int cpu)
2000{ 2000{
2001 struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); 2001 struct device *dev = &per_cpu(mce_device, cpu);
2002 int i; 2002 int i;
2003 2003
2004 if (!cpumask_test_cpu(cpu, mce_sysdev_initialized)) 2004 if (!cpumask_test_cpu(cpu, mce_device_initialized))
2005 return; 2005 return;
2006 2006
2007 for (i = 0; mce_sysdev_attrs[i]; i++) 2007 for (i = 0; mce_device_attrs[i]; i++)
2008 sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); 2008 device_remove_file(dev, mce_device_attrs[i]);
2009 2009
2010 for (i = 0; i < banks; i++) 2010 for (i = 0; i < banks; i++)
2011 sysdev_remove_file(sysdev, &mce_banks[i].attr); 2011 device_remove_file(dev, &mce_banks[i].attr);
2012 2012
2013 sysdev_unregister(sysdev); 2013 device_unregister(dev);
2014 cpumask_clear_cpu(cpu, mce_sysdev_initialized); 2014 cpumask_clear_cpu(cpu, mce_device_initialized);
2015} 2015}
2016 2016
2017/* Make sure there are no machine checks on offlined CPUs. */ 2017/* Make sure there are no machine checks on offlined CPUs. */
@@ -2061,7 +2061,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2061 switch (action) { 2061 switch (action) {
2062 case CPU_ONLINE: 2062 case CPU_ONLINE:
2063 case CPU_ONLINE_FROZEN: 2063 case CPU_ONLINE_FROZEN:
2064 mce_sysdev_create(cpu); 2064 mce_device_create(cpu);
2065 if (threshold_cpu_callback) 2065 if (threshold_cpu_callback)
2066 threshold_cpu_callback(action, cpu); 2066 threshold_cpu_callback(action, cpu);
2067 break; 2067 break;
@@ -2069,7 +2069,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2069 case CPU_DEAD_FROZEN: 2069 case CPU_DEAD_FROZEN:
2070 if (threshold_cpu_callback) 2070 if (threshold_cpu_callback)
2071 threshold_cpu_callback(action, cpu); 2071 threshold_cpu_callback(action, cpu);
2072 mce_sysdev_remove(cpu); 2072 mce_device_remove(cpu);
2073 break; 2073 break;
2074 case CPU_DOWN_PREPARE: 2074 case CPU_DOWN_PREPARE:
2075 case CPU_DOWN_PREPARE_FROZEN: 2075 case CPU_DOWN_PREPARE_FROZEN:
@@ -2103,7 +2103,7 @@ static __init void mce_init_banks(void)
2103 2103
2104 for (i = 0; i < banks; i++) { 2104 for (i = 0; i < banks; i++) {
2105 struct mce_bank *b = &mce_banks[i]; 2105 struct mce_bank *b = &mce_banks[i];
2106 struct sysdev_attribute *a = &b->attr; 2106 struct device_attribute *a = &b->attr;
2107 2107
2108 sysfs_attr_init(&a->attr); 2108 sysfs_attr_init(&a->attr);
2109 a->attr.name = b->attrname; 2109 a->attr.name = b->attrname;
@@ -2123,16 +2123,16 @@ static __init int mcheck_init_device(void)
2123 if (!mce_available(&boot_cpu_data)) 2123 if (!mce_available(&boot_cpu_data))
2124 return -EIO; 2124 return -EIO;
2125 2125
2126 zalloc_cpumask_var(&mce_sysdev_initialized, GFP_KERNEL); 2126 zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL);
2127 2127
2128 mce_init_banks(); 2128 mce_init_banks();
2129 2129
2130 err = sysdev_class_register(&mce_sysdev_class); 2130 err = subsys_system_register(&mce_subsys, NULL);
2131 if (err) 2131 if (err)
2132 return err; 2132 return err;
2133 2133
2134 for_each_online_cpu(i) { 2134 for_each_online_cpu(i) {
2135 err = mce_sysdev_create(i); 2135 err = mce_device_create(i);
2136 if (err) 2136 if (err)
2137 return err; 2137 return err;
2138 } 2138 }
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index f5474218cffe..56d2aa1acd55 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -17,7 +17,6 @@
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/kobject.h> 18#include <linux/kobject.h>
19#include <linux/percpu.h> 19#include <linux/percpu.h>
20#include <linux/sysdev.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
22#include <linux/sched.h> 21#include <linux/sched.h>
23#include <linux/sysfs.h> 22#include <linux/sysfs.h>
@@ -548,7 +547,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
548 if (!b) 547 if (!b)
549 goto out; 548 goto out;
550 549
551 err = sysfs_create_link(&per_cpu(mce_sysdev, cpu).kobj, 550 err = sysfs_create_link(&per_cpu(mce_device, cpu).kobj,
552 b->kobj, name); 551 b->kobj, name);
553 if (err) 552 if (err)
554 goto out; 553 goto out;
@@ -571,7 +570,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
571 goto out; 570 goto out;
572 } 571 }
573 572
574 b->kobj = kobject_create_and_add(name, &per_cpu(mce_sysdev, cpu).kobj); 573 b->kobj = kobject_create_and_add(name, &per_cpu(mce_device, cpu).kobj);
575 if (!b->kobj) 574 if (!b->kobj)
576 goto out_free; 575 goto out_free;
577 576
@@ -591,7 +590,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
591 if (i == cpu) 590 if (i == cpu)
592 continue; 591 continue;
593 592
594 err = sysfs_create_link(&per_cpu(mce_sysdev, i).kobj, 593 err = sysfs_create_link(&per_cpu(mce_device, i).kobj,
595 b->kobj, name); 594 b->kobj, name);
596 if (err) 595 if (err)
597 goto out; 596 goto out;
@@ -669,7 +668,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
669#ifdef CONFIG_SMP 668#ifdef CONFIG_SMP
670 /* sibling symlink */ 669 /* sibling symlink */
671 if (shared_bank[bank] && b->blocks->cpu != cpu) { 670 if (shared_bank[bank] && b->blocks->cpu != cpu) {
672 sysfs_remove_link(&per_cpu(mce_sysdev, cpu).kobj, name); 671 sysfs_remove_link(&per_cpu(mce_device, cpu).kobj, name);
673 per_cpu(threshold_banks, cpu)[bank] = NULL; 672 per_cpu(threshold_banks, cpu)[bank] = NULL;
674 673
675 return; 674 return;
@@ -681,7 +680,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
681 if (i == cpu) 680 if (i == cpu)
682 continue; 681 continue;
683 682
684 sysfs_remove_link(&per_cpu(mce_sysdev, i).kobj, name); 683 sysfs_remove_link(&per_cpu(mce_device, i).kobj, name);
685 per_cpu(threshold_banks, i)[bank] = NULL; 684 per_cpu(threshold_banks, i)[bank] = NULL;
686 } 685 }
687 686
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 787e06c84ea6..59e3f6ed265f 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/percpu.h> 20#include <linux/percpu.h>
21#include <linux/export.h> 21#include <linux/export.h>
22#include <linux/sysdev.h>
23#include <linux/types.h> 22#include <linux/types.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/smp.h> 24#include <linux/smp.h>
@@ -69,16 +68,16 @@ static atomic_t therm_throt_en = ATOMIC_INIT(0);
69static u32 lvtthmr_init __read_mostly; 68static u32 lvtthmr_init __read_mostly;
70 69
71#ifdef CONFIG_SYSFS 70#ifdef CONFIG_SYSFS
72#define define_therm_throt_sysdev_one_ro(_name) \ 71#define define_therm_throt_device_one_ro(_name) \
73 static SYSDEV_ATTR(_name, 0444, \ 72 static DEVICE_ATTR(_name, 0444, \
74 therm_throt_sysdev_show_##_name, \ 73 therm_throt_device_show_##_name, \
75 NULL) \ 74 NULL) \
76 75
77#define define_therm_throt_sysdev_show_func(event, name) \ 76#define define_therm_throt_device_show_func(event, name) \
78 \ 77 \
79static ssize_t therm_throt_sysdev_show_##event##_##name( \ 78static ssize_t therm_throt_device_show_##event##_##name( \
80 struct sys_device *dev, \ 79 struct device *dev, \
81 struct sysdev_attribute *attr, \ 80 struct device_attribute *attr, \
82 char *buf) \ 81 char *buf) \
83{ \ 82{ \
84 unsigned int cpu = dev->id; \ 83 unsigned int cpu = dev->id; \
@@ -95,20 +94,20 @@ static ssize_t therm_throt_sysdev_show_##event##_##name( \
95 return ret; \ 94 return ret; \
96} 95}
97 96
98define_therm_throt_sysdev_show_func(core_throttle, count); 97define_therm_throt_device_show_func(core_throttle, count);
99define_therm_throt_sysdev_one_ro(core_throttle_count); 98define_therm_throt_device_one_ro(core_throttle_count);
100 99
101define_therm_throt_sysdev_show_func(core_power_limit, count); 100define_therm_throt_device_show_func(core_power_limit, count);
102define_therm_throt_sysdev_one_ro(core_power_limit_count); 101define_therm_throt_device_one_ro(core_power_limit_count);
103 102
104define_therm_throt_sysdev_show_func(package_throttle, count); 103define_therm_throt_device_show_func(package_throttle, count);
105define_therm_throt_sysdev_one_ro(package_throttle_count); 104define_therm_throt_device_one_ro(package_throttle_count);
106 105
107define_therm_throt_sysdev_show_func(package_power_limit, count); 106define_therm_throt_device_show_func(package_power_limit, count);
108define_therm_throt_sysdev_one_ro(package_power_limit_count); 107define_therm_throt_device_one_ro(package_power_limit_count);
109 108
110static struct attribute *thermal_throttle_attrs[] = { 109static struct attribute *thermal_throttle_attrs[] = {
111 &attr_core_throttle_count.attr, 110 &dev_attr_core_throttle_count.attr,
112 NULL 111 NULL
113}; 112};
114 113
@@ -223,36 +222,36 @@ static int thresh_event_valid(int event)
223 222
224#ifdef CONFIG_SYSFS 223#ifdef CONFIG_SYSFS
225/* Add/Remove thermal_throttle interface for CPU device: */ 224/* Add/Remove thermal_throttle interface for CPU device: */
226static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, 225static __cpuinit int thermal_throttle_add_dev(struct device *dev,
227 unsigned int cpu) 226 unsigned int cpu)
228{ 227{
229 int err; 228 int err;
230 struct cpuinfo_x86 *c = &cpu_data(cpu); 229 struct cpuinfo_x86 *c = &cpu_data(cpu);
231 230
232 err = sysfs_create_group(&sys_dev->kobj, &thermal_attr_group); 231 err = sysfs_create_group(&dev->kobj, &thermal_attr_group);
233 if (err) 232 if (err)
234 return err; 233 return err;
235 234
236 if (cpu_has(c, X86_FEATURE_PLN)) 235 if (cpu_has(c, X86_FEATURE_PLN))
237 err = sysfs_add_file_to_group(&sys_dev->kobj, 236 err = sysfs_add_file_to_group(&dev->kobj,
238 &attr_core_power_limit_count.attr, 237 &dev_attr_core_power_limit_count.attr,
239 thermal_attr_group.name); 238 thermal_attr_group.name);
240 if (cpu_has(c, X86_FEATURE_PTS)) { 239 if (cpu_has(c, X86_FEATURE_PTS)) {
241 err = sysfs_add_file_to_group(&sys_dev->kobj, 240 err = sysfs_add_file_to_group(&dev->kobj,
242 &attr_package_throttle_count.attr, 241 &dev_attr_package_throttle_count.attr,
243 thermal_attr_group.name); 242 thermal_attr_group.name);
244 if (cpu_has(c, X86_FEATURE_PLN)) 243 if (cpu_has(c, X86_FEATURE_PLN))
245 err = sysfs_add_file_to_group(&sys_dev->kobj, 244 err = sysfs_add_file_to_group(&dev->kobj,
246 &attr_package_power_limit_count.attr, 245 &dev_attr_package_power_limit_count.attr,
247 thermal_attr_group.name); 246 thermal_attr_group.name);
248 } 247 }
249 248
250 return err; 249 return err;
251} 250}
252 251
253static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) 252static __cpuinit void thermal_throttle_remove_dev(struct device *dev)
254{ 253{
255 sysfs_remove_group(&sys_dev->kobj, &thermal_attr_group); 254 sysfs_remove_group(&dev->kobj, &thermal_attr_group);
256} 255}
257 256
258/* Mutex protecting device creation against CPU hotplug: */ 257/* Mutex protecting device creation against CPU hotplug: */
@@ -265,16 +264,16 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
265 void *hcpu) 264 void *hcpu)
266{ 265{
267 unsigned int cpu = (unsigned long)hcpu; 266 unsigned int cpu = (unsigned long)hcpu;
268 struct sys_device *sys_dev; 267 struct device *dev;
269 int err = 0; 268 int err = 0;
270 269
271 sys_dev = get_cpu_sysdev(cpu); 270 dev = get_cpu_device(cpu);
272 271
273 switch (action) { 272 switch (action) {
274 case CPU_UP_PREPARE: 273 case CPU_UP_PREPARE:
275 case CPU_UP_PREPARE_FROZEN: 274 case CPU_UP_PREPARE_FROZEN:
276 mutex_lock(&therm_cpu_lock); 275 mutex_lock(&therm_cpu_lock);
277 err = thermal_throttle_add_dev(sys_dev, cpu); 276 err = thermal_throttle_add_dev(dev, cpu);
278 mutex_unlock(&therm_cpu_lock); 277 mutex_unlock(&therm_cpu_lock);
279 WARN_ON(err); 278 WARN_ON(err);
280 break; 279 break;
@@ -283,7 +282,7 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
283 case CPU_DEAD: 282 case CPU_DEAD:
284 case CPU_DEAD_FROZEN: 283 case CPU_DEAD_FROZEN:
285 mutex_lock(&therm_cpu_lock); 284 mutex_lock(&therm_cpu_lock);
286 thermal_throttle_remove_dev(sys_dev); 285 thermal_throttle_remove_dev(dev);
287 mutex_unlock(&therm_cpu_lock); 286 mutex_unlock(&therm_cpu_lock);
288 break; 287 break;
289 } 288 }
@@ -310,7 +309,7 @@ static __init int thermal_throttle_init_device(void)
310#endif 309#endif
311 /* connect live CPUs to sysfs */ 310 /* connect live CPUs to sysfs */
312 for_each_online_cpu(cpu) { 311 for_each_online_cpu(cpu) {
313 err = thermal_throttle_add_dev(get_cpu_sysdev(cpu), cpu); 312 err = thermal_throttle_add_dev(get_cpu_device(cpu), cpu);
314 WARN_ON(err); 313 WARN_ON(err);
315 } 314 }
316#ifdef CONFIG_HOTPLUG_CPU 315#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 1bb0bf4d92cd..56258f1c488e 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -2,7 +2,6 @@
2#include <linux/clockchips.h> 2#include <linux/clockchips.h>
3#include <linux/interrupt.h> 3#include <linux/interrupt.h>
4#include <linux/export.h> 4#include <linux/export.h>
5#include <linux/sysdev.h>
6#include <linux/delay.h> 5#include <linux/delay.h>
7#include <linux/errno.h> 6#include <linux/errno.h>
8#include <linux/i8253.h> 7#include <linux/i8253.h>
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index b3300e6bacef..313fb5cddbce 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -9,7 +9,7 @@
9#include <linux/kprobes.h> 9#include <linux/kprobes.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/kernel_stat.h> 11#include <linux/kernel_stat.h>
12#include <linux/sysdev.h> 12#include <linux/device.h>
13#include <linux/bitops.h> 13#include <linux/bitops.h>
14#include <linux/acpi.h> 14#include <linux/acpi.h>
15#include <linux/io.h> 15#include <linux/io.h>
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 9d46f5e43b51..c6aa7eb6cda4 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -292,8 +292,8 @@ static int reload_for_cpu(int cpu)
292 return err; 292 return err;
293} 293}
294 294
295static ssize_t reload_store(struct sys_device *dev, 295static ssize_t reload_store(struct device *dev,
296 struct sysdev_attribute *attr, 296 struct device_attribute *attr,
297 const char *buf, size_t size) 297 const char *buf, size_t size)
298{ 298{
299 unsigned long val; 299 unsigned long val;
@@ -318,30 +318,30 @@ static ssize_t reload_store(struct sys_device *dev,
318 return ret; 318 return ret;
319} 319}
320 320
321static ssize_t version_show(struct sys_device *dev, 321static ssize_t version_show(struct device *dev,
322 struct sysdev_attribute *attr, char *buf) 322 struct device_attribute *attr, char *buf)
323{ 323{
324 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; 324 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
325 325
326 return sprintf(buf, "0x%x\n", uci->cpu_sig.rev); 326 return sprintf(buf, "0x%x\n", uci->cpu_sig.rev);
327} 327}
328 328
329static ssize_t pf_show(struct sys_device *dev, 329static ssize_t pf_show(struct device *dev,
330 struct sysdev_attribute *attr, char *buf) 330 struct device_attribute *attr, char *buf)
331{ 331{
332 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; 332 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
333 333
334 return sprintf(buf, "0x%x\n", uci->cpu_sig.pf); 334 return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
335} 335}
336 336
337static SYSDEV_ATTR(reload, 0200, NULL, reload_store); 337static DEVICE_ATTR(reload, 0200, NULL, reload_store);
338static SYSDEV_ATTR(version, 0400, version_show, NULL); 338static DEVICE_ATTR(version, 0400, version_show, NULL);
339static SYSDEV_ATTR(processor_flags, 0400, pf_show, NULL); 339static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
340 340
341static struct attribute *mc_default_attrs[] = { 341static struct attribute *mc_default_attrs[] = {
342 &attr_reload.attr, 342 &dev_attr_reload.attr,
343 &attr_version.attr, 343 &dev_attr_version.attr,
344 &attr_processor_flags.attr, 344 &dev_attr_processor_flags.attr,
345 NULL 345 NULL
346}; 346};
347 347
@@ -405,43 +405,45 @@ static enum ucode_state microcode_update_cpu(int cpu)
405 return ustate; 405 return ustate;
406} 406}
407 407
408static int mc_sysdev_add(struct sys_device *sys_dev) 408static int mc_device_add(struct device *dev, struct subsys_interface *sif)
409{ 409{
410 int err, cpu = sys_dev->id; 410 int err, cpu = dev->id;
411 411
412 if (!cpu_online(cpu)) 412 if (!cpu_online(cpu))
413 return 0; 413 return 0;
414 414
415 pr_debug("CPU%d added\n", cpu); 415 pr_debug("CPU%d added\n", cpu);
416 416
417 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); 417 err = sysfs_create_group(&dev->kobj, &mc_attr_group);
418 if (err) 418 if (err)
419 return err; 419 return err;
420 420
421 if (microcode_init_cpu(cpu) == UCODE_ERROR) { 421 if (microcode_init_cpu(cpu) == UCODE_ERROR) {
422 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 422 sysfs_remove_group(&dev->kobj, &mc_attr_group);
423 return -EINVAL; 423 return -EINVAL;
424 } 424 }
425 425
426 return err; 426 return err;
427} 427}
428 428
429static int mc_sysdev_remove(struct sys_device *sys_dev) 429static int mc_device_remove(struct device *dev, struct subsys_interface *sif)
430{ 430{
431 int cpu = sys_dev->id; 431 int cpu = dev->id;
432 432
433 if (!cpu_online(cpu)) 433 if (!cpu_online(cpu))
434 return 0; 434 return 0;
435 435
436 pr_debug("CPU%d removed\n", cpu); 436 pr_debug("CPU%d removed\n", cpu);
437 microcode_fini_cpu(cpu); 437 microcode_fini_cpu(cpu);
438 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 438 sysfs_remove_group(&dev->kobj, &mc_attr_group);
439 return 0; 439 return 0;
440} 440}
441 441
442static struct sysdev_driver mc_sysdev_driver = { 442static struct subsys_interface mc_cpu_interface = {
443 .add = mc_sysdev_add, 443 .name = "microcode",
444 .remove = mc_sysdev_remove, 444 .subsys = &cpu_subsys,
445 .add_dev = mc_device_add,
446 .remove_dev = mc_device_remove,
445}; 447};
446 448
447/** 449/**
@@ -464,9 +466,9 @@ static __cpuinit int
464mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) 466mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
465{ 467{
466 unsigned int cpu = (unsigned long)hcpu; 468 unsigned int cpu = (unsigned long)hcpu;
467 struct sys_device *sys_dev; 469 struct device *dev;
468 470
469 sys_dev = get_cpu_sysdev(cpu); 471 dev = get_cpu_device(cpu);
470 switch (action) { 472 switch (action) {
471 case CPU_ONLINE: 473 case CPU_ONLINE:
472 case CPU_ONLINE_FROZEN: 474 case CPU_ONLINE_FROZEN:
@@ -474,13 +476,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
474 case CPU_DOWN_FAILED: 476 case CPU_DOWN_FAILED:
475 case CPU_DOWN_FAILED_FROZEN: 477 case CPU_DOWN_FAILED_FROZEN:
476 pr_debug("CPU%d added\n", cpu); 478 pr_debug("CPU%d added\n", cpu);
477 if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group)) 479 if (sysfs_create_group(&dev->kobj, &mc_attr_group))
478 pr_err("Failed to create group for CPU%d\n", cpu); 480 pr_err("Failed to create group for CPU%d\n", cpu);
479 break; 481 break;
480 case CPU_DOWN_PREPARE: 482 case CPU_DOWN_PREPARE:
481 case CPU_DOWN_PREPARE_FROZEN: 483 case CPU_DOWN_PREPARE_FROZEN:
482 /* Suspend is in progress, only remove the interface */ 484 /* Suspend is in progress, only remove the interface */
483 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 485 sysfs_remove_group(&dev->kobj, &mc_attr_group);
484 pr_debug("CPU%d removed\n", cpu); 486 pr_debug("CPU%d removed\n", cpu);
485 break; 487 break;
486 488
@@ -525,7 +527,7 @@ static int __init microcode_init(void)
525 get_online_cpus(); 527 get_online_cpus();
526 mutex_lock(&microcode_mutex); 528 mutex_lock(&microcode_mutex);
527 529
528 error = sysdev_driver_register(&cpu_sysdev_class, &mc_sysdev_driver); 530 error = subsys_interface_register(&mc_cpu_interface);
529 531
530 mutex_unlock(&microcode_mutex); 532 mutex_unlock(&microcode_mutex);
531 put_online_cpus(); 533 put_online_cpus();
@@ -535,7 +537,7 @@ static int __init microcode_init(void)
535 537
536 error = microcode_dev_init(); 538 error = microcode_dev_init();
537 if (error) 539 if (error)
538 goto out_sysdev_driver; 540 goto out_driver;
539 541
540 register_syscore_ops(&mc_syscore_ops); 542 register_syscore_ops(&mc_syscore_ops);
541 register_hotcpu_notifier(&mc_cpu_notifier); 543 register_hotcpu_notifier(&mc_cpu_notifier);
@@ -545,11 +547,11 @@ static int __init microcode_init(void)
545 547
546 return 0; 548 return 0;
547 549
548out_sysdev_driver: 550out_driver:
549 get_online_cpus(); 551 get_online_cpus();
550 mutex_lock(&microcode_mutex); 552 mutex_lock(&microcode_mutex);
551 553
552 sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); 554 subsys_interface_unregister(&mc_cpu_interface);
553 555
554 mutex_unlock(&microcode_mutex); 556 mutex_unlock(&microcode_mutex);
555 put_online_cpus(); 557 put_online_cpus();
@@ -571,7 +573,7 @@ static void __exit microcode_exit(void)
571 get_online_cpus(); 573 get_online_cpus();
572 mutex_lock(&microcode_mutex); 574 mutex_lock(&microcode_mutex);
573 575
574 sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); 576 subsys_interface_unregister(&mc_cpu_interface);
575 577
576 mutex_unlock(&microcode_mutex); 578 mutex_unlock(&microcode_mutex);
577 put_online_cpus(); 579 put_online_cpus();
diff --git a/arch/x86/platform/uv/uv_sysfs.c b/arch/x86/platform/uv/uv_sysfs.c
index 309c70fb7759..5d4ba301e776 100644
--- a/arch/x86/platform/uv/uv_sysfs.c
+++ b/arch/x86/platform/uv/uv_sysfs.c
@@ -19,7 +19,7 @@
19 * Copyright (c) Russ Anderson 19 * Copyright (c) Russ Anderson
20 */ 20 */
21 21
22#include <linux/sysdev.h> 22#include <linux/device.h>
23#include <asm/uv/bios.h> 23#include <asm/uv/bios.h>
24#include <asm/uv/uv.h> 24#include <asm/uv/uv.h>
25 25
diff --git a/drivers/Kconfig b/drivers/Kconfig
index b5e6f243f749..5afe5d1f199b 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -116,6 +116,8 @@ source "drivers/vlynq/Kconfig"
116 116
117source "drivers/virtio/Kconfig" 117source "drivers/virtio/Kconfig"
118 118
119source "drivers/hv/Kconfig"
120
119source "drivers/xen/Kconfig" 121source "drivers/xen/Kconfig"
120 122
121source "drivers/staging/Kconfig" 123source "drivers/staging/Kconfig"
@@ -132,8 +134,6 @@ source "drivers/iommu/Kconfig"
132 134
133source "drivers/virt/Kconfig" 135source "drivers/virt/Kconfig"
134 136
135source "drivers/hv/Kconfig"
136
137source "drivers/devfreq/Kconfig" 137source "drivers/devfreq/Kconfig"
138 138
139endmenu 139endmenu
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 9d7bc9f6b6cc..20a68ca386de 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -446,7 +446,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
446{ 446{
447 struct acpi_processor *pr = NULL; 447 struct acpi_processor *pr = NULL;
448 int result = 0; 448 int result = 0;
449 struct sys_device *sysdev; 449 struct device *dev;
450 450
451 pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); 451 pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
452 if (!pr) 452 if (!pr)
@@ -491,8 +491,8 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
491 491
492 per_cpu(processors, pr->id) = pr; 492 per_cpu(processors, pr->id) = pr;
493 493
494 sysdev = get_cpu_sysdev(pr->id); 494 dev = get_cpu_device(pr->id);
495 if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { 495 if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) {
496 result = -EFAULT; 496 result = -EFAULT;
497 goto err_free_cpumask; 497 goto err_free_cpumask;
498 } 498 }
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
index 870550d6a4bf..3b599abf2b40 100644
--- a/drivers/acpi/processor_thermal.c
+++ b/drivers/acpi/processor_thermal.c
@@ -30,7 +30,6 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/cpufreq.h> 32#include <linux/cpufreq.h>
33#include <linux/sysdev.h>
34 33
35#include <asm/uaccess.h> 34#include <asm/uaccess.h>
36 35
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index 99a375ad2cc9..1334d893b560 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -3,7 +3,8 @@
3obj-y := core.o sys.o bus.o dd.o syscore.o \ 3obj-y := core.o sys.o bus.o dd.o syscore.o \
4 driver.o class.o platform.o \ 4 driver.o class.o platform.o \
5 cpu.o firmware.o init.o map.o devres.o \ 5 cpu.o firmware.o init.o map.o devres.o \
6 attribute_container.o transport_class.o 6 attribute_container.o transport_class.o \
7 topology.o
7obj-$(CONFIG_DEVTMPFS) += devtmpfs.o 8obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
8obj-y += power/ 9obj-y += power/
9obj-$(CONFIG_HAS_DMA) += dma-mapping.o 10obj-$(CONFIG_HAS_DMA) += dma-mapping.o
@@ -12,7 +13,6 @@ obj-$(CONFIG_ISA) += isa.o
12obj-$(CONFIG_FW_LOADER) += firmware_class.o 13obj-$(CONFIG_FW_LOADER) += firmware_class.o
13obj-$(CONFIG_NUMA) += node.o 14obj-$(CONFIG_NUMA) += node.o
14obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o 15obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o
15obj-$(CONFIG_SMP) += topology.o
16ifeq ($(CONFIG_SYSFS),y) 16ifeq ($(CONFIG_SYSFS),y)
17obj-$(CONFIG_MODULES) += module.o 17obj-$(CONFIG_MODULES) += module.o
18endif 18endif
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 21c1b96c34c6..7a6ae4228761 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -4,7 +4,9 @@
4 * struct subsys_private - structure to hold the private to the driver core portions of the bus_type/class structure. 4 * struct subsys_private - structure to hold the private to the driver core portions of the bus_type/class structure.
5 * 5 *
6 * @subsys - the struct kset that defines this subsystem 6 * @subsys - the struct kset that defines this subsystem
7 * @devices_kset - the list of devices associated 7 * @devices_kset - the subsystem's 'devices' directory
8 * @interfaces - list of subsystem interfaces associated
9 * @mutex - protect the devices, and interfaces lists.
8 * 10 *
9 * @drivers_kset - the list of drivers associated 11 * @drivers_kset - the list of drivers associated
10 * @klist_devices - the klist to iterate over the @devices_kset 12 * @klist_devices - the klist to iterate over the @devices_kset
@@ -14,10 +16,8 @@
14 * @bus - pointer back to the struct bus_type that this structure is associated 16 * @bus - pointer back to the struct bus_type that this structure is associated
15 * with. 17 * with.
16 * 18 *
17 * @class_interfaces - list of class_interfaces associated
18 * @glue_dirs - "glue" directory to put in-between the parent device to 19 * @glue_dirs - "glue" directory to put in-between the parent device to
19 * avoid namespace conflicts 20 * avoid namespace conflicts
20 * @class_mutex - mutex to protect the children, devices, and interfaces lists.
21 * @class - pointer back to the struct class that this structure is associated 21 * @class - pointer back to the struct class that this structure is associated
22 * with. 22 * with.
23 * 23 *
@@ -28,6 +28,8 @@
28struct subsys_private { 28struct subsys_private {
29 struct kset subsys; 29 struct kset subsys;
30 struct kset *devices_kset; 30 struct kset *devices_kset;
31 struct list_head interfaces;
32 struct mutex mutex;
31 33
32 struct kset *drivers_kset; 34 struct kset *drivers_kset;
33 struct klist klist_devices; 35 struct klist klist_devices;
@@ -36,9 +38,7 @@ struct subsys_private {
36 unsigned int drivers_autoprobe:1; 38 unsigned int drivers_autoprobe:1;
37 struct bus_type *bus; 39 struct bus_type *bus;
38 40
39 struct list_head class_interfaces;
40 struct kset glue_dirs; 41 struct kset glue_dirs;
41 struct mutex class_mutex;
42 struct class *class; 42 struct class *class;
43}; 43};
44#define to_subsys_private(obj) container_of(obj, struct subsys_private, subsys.kobj) 44#define to_subsys_private(obj) container_of(obj, struct subsys_private, subsys.kobj)
@@ -94,7 +94,6 @@ extern int hypervisor_init(void);
94static inline int hypervisor_init(void) { return 0; } 94static inline int hypervisor_init(void) { return 0; }
95#endif 95#endif
96extern int platform_bus_init(void); 96extern int platform_bus_init(void);
97extern int system_bus_init(void);
98extern int cpu_dev_init(void); 97extern int cpu_dev_init(void);
99 98
100extern int bus_add_device(struct device *dev); 99extern int bus_add_device(struct device *dev);
@@ -116,6 +115,7 @@ extern char *make_class_name(const char *name, struct kobject *kobj);
116 115
117extern int devres_release_all(struct device *dev); 116extern int devres_release_all(struct device *dev);
118 117
118/* /sys/devices directory */
119extern struct kset *devices_kset; 119extern struct kset *devices_kset;
120 120
121#if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS) 121#if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 000e7b2006f8..99dc5921e1dd 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -16,9 +16,14 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/string.h> 18#include <linux/string.h>
19#include <linux/mutex.h>
19#include "base.h" 20#include "base.h"
20#include "power/power.h" 21#include "power/power.h"
21 22
23/* /sys/devices/system */
24/* FIXME: make static after drivers/base/sys.c is deleted */
25struct kset *system_kset;
26
22#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) 27#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
23 28
24/* 29/*
@@ -360,6 +365,47 @@ struct device *bus_find_device_by_name(struct bus_type *bus,
360} 365}
361EXPORT_SYMBOL_GPL(bus_find_device_by_name); 366EXPORT_SYMBOL_GPL(bus_find_device_by_name);
362 367
368/**
369 * subsys_find_device_by_id - find a device with a specific enumeration number
370 * @subsys: subsystem
371 * @id: index 'id' in struct device
372 * @hint: device to check first
373 *
374 * Check the hint's next object and if it is a match return it directly,
375 * otherwise, fall back to a full list search. Either way a reference for
376 * the returned object is taken.
377 */
378struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id,
379 struct device *hint)
380{
381 struct klist_iter i;
382 struct device *dev;
383
384 if (!subsys)
385 return NULL;
386
387 if (hint) {
388 klist_iter_init_node(&subsys->p->klist_devices, &i, &hint->p->knode_bus);
389 dev = next_device(&i);
390 if (dev && dev->id == id && get_device(dev)) {
391 klist_iter_exit(&i);
392 return dev;
393 }
394 klist_iter_exit(&i);
395 }
396
397 klist_iter_init_node(&subsys->p->klist_devices, &i, NULL);
398 while ((dev = next_device(&i))) {
399 if (dev->id == id && get_device(dev)) {
400 klist_iter_exit(&i);
401 return dev;
402 }
403 }
404 klist_iter_exit(&i);
405 return NULL;
406}
407EXPORT_SYMBOL_GPL(subsys_find_device_by_id);
408
363static struct device_driver *next_driver(struct klist_iter *i) 409static struct device_driver *next_driver(struct klist_iter *i)
364{ 410{
365 struct klist_node *n = klist_next(i); 411 struct klist_node *n = klist_next(i);
@@ -487,38 +533,59 @@ out_put:
487void bus_probe_device(struct device *dev) 533void bus_probe_device(struct device *dev)
488{ 534{
489 struct bus_type *bus = dev->bus; 535 struct bus_type *bus = dev->bus;
536 struct subsys_interface *sif;
490 int ret; 537 int ret;
491 538
492 if (bus && bus->p->drivers_autoprobe) { 539 if (!bus)
540 return;
541
542 if (bus->p->drivers_autoprobe) {
493 ret = device_attach(dev); 543 ret = device_attach(dev);
494 WARN_ON(ret < 0); 544 WARN_ON(ret < 0);
495 } 545 }
546
547 mutex_lock(&bus->p->mutex);
548 list_for_each_entry(sif, &bus->p->interfaces, node)
549 if (sif->add_dev)
550 sif->add_dev(dev, sif);
551 mutex_unlock(&bus->p->mutex);
496} 552}
497 553
498/** 554/**
499 * bus_remove_device - remove device from bus 555 * bus_remove_device - remove device from bus
500 * @dev: device to be removed 556 * @dev: device to be removed
501 * 557 *
502 * - Remove symlink from bus's directory. 558 * - Remove device from all interfaces.
559 * - Remove symlink from bus' directory.
503 * - Delete device from bus's list. 560 * - Delete device from bus's list.
504 * - Detach from its driver. 561 * - Detach from its driver.
505 * - Drop reference taken in bus_add_device(). 562 * - Drop reference taken in bus_add_device().
506 */ 563 */
507void bus_remove_device(struct device *dev) 564void bus_remove_device(struct device *dev)
508{ 565{
509 if (dev->bus) { 566 struct bus_type *bus = dev->bus;
510 sysfs_remove_link(&dev->kobj, "subsystem"); 567 struct subsys_interface *sif;
511 sysfs_remove_link(&dev->bus->p->devices_kset->kobj, 568
512 dev_name(dev)); 569 if (!bus)
513 device_remove_attrs(dev->bus, dev); 570 return;
514 if (klist_node_attached(&dev->p->knode_bus)) 571
515 klist_del(&dev->p->knode_bus); 572 mutex_lock(&bus->p->mutex);
516 573 list_for_each_entry(sif, &bus->p->interfaces, node)
517 pr_debug("bus: '%s': remove device %s\n", 574 if (sif->remove_dev)
518 dev->bus->name, dev_name(dev)); 575 sif->remove_dev(dev, sif);
519 device_release_driver(dev); 576 mutex_unlock(&bus->p->mutex);
520 bus_put(dev->bus); 577
521 } 578 sysfs_remove_link(&dev->kobj, "subsystem");
579 sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
580 dev_name(dev));
581 device_remove_attrs(dev->bus, dev);
582 if (klist_node_attached(&dev->p->knode_bus))
583 klist_del(&dev->p->knode_bus);
584
585 pr_debug("bus: '%s': remove device %s\n",
586 dev->bus->name, dev_name(dev));
587 device_release_driver(dev);
588 bus_put(dev->bus);
522} 589}
523 590
524static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv) 591static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv)
@@ -847,14 +914,14 @@ static ssize_t bus_uevent_store(struct bus_type *bus,
847static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store); 914static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store);
848 915
849/** 916/**
850 * bus_register - register a bus with the system. 917 * __bus_register - register a driver-core subsystem
851 * @bus: bus. 918 * @bus: bus.
852 * 919 *
853 * Once we have that, we registered the bus with the kobject 920 * Once we have that, we registered the bus with the kobject
854 * infrastructure, then register the children subsystems it has: 921 * infrastructure, then register the children subsystems it has:
855 * the devices and drivers that belong to the bus. 922 * the devices and drivers that belong to the subsystem.
856 */ 923 */
857int bus_register(struct bus_type *bus) 924int __bus_register(struct bus_type *bus, struct lock_class_key *key)
858{ 925{
859 int retval; 926 int retval;
860 struct subsys_private *priv; 927 struct subsys_private *priv;
@@ -898,6 +965,8 @@ int bus_register(struct bus_type *bus)
898 goto bus_drivers_fail; 965 goto bus_drivers_fail;
899 } 966 }
900 967
968 INIT_LIST_HEAD(&priv->interfaces);
969 __mutex_init(&priv->mutex, "subsys mutex", key);
901 klist_init(&priv->klist_devices, klist_devices_get, klist_devices_put); 970 klist_init(&priv->klist_devices, klist_devices_get, klist_devices_put);
902 klist_init(&priv->klist_drivers, NULL, NULL); 971 klist_init(&priv->klist_drivers, NULL, NULL);
903 972
@@ -927,7 +996,7 @@ out:
927 bus->p = NULL; 996 bus->p = NULL;
928 return retval; 997 return retval;
929} 998}
930EXPORT_SYMBOL_GPL(bus_register); 999EXPORT_SYMBOL_GPL(__bus_register);
931 1000
932/** 1001/**
933 * bus_unregister - remove a bus from the system 1002 * bus_unregister - remove a bus from the system
@@ -939,6 +1008,8 @@ EXPORT_SYMBOL_GPL(bus_register);
939void bus_unregister(struct bus_type *bus) 1008void bus_unregister(struct bus_type *bus)
940{ 1009{
941 pr_debug("bus: '%s': unregistering\n", bus->name); 1010 pr_debug("bus: '%s': unregistering\n", bus->name);
1011 if (bus->dev_root)
1012 device_unregister(bus->dev_root);
942 bus_remove_attrs(bus); 1013 bus_remove_attrs(bus);
943 remove_probe_files(bus); 1014 remove_probe_files(bus);
944 kset_unregister(bus->p->drivers_kset); 1015 kset_unregister(bus->p->drivers_kset);
@@ -1028,10 +1099,194 @@ void bus_sort_breadthfirst(struct bus_type *bus,
1028} 1099}
1029EXPORT_SYMBOL_GPL(bus_sort_breadthfirst); 1100EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
1030 1101
1102/**
1103 * subsys_dev_iter_init - initialize subsys device iterator
1104 * @iter: subsys iterator to initialize
1105 * @subsys: the subsys we wanna iterate over
1106 * @start: the device to start iterating from, if any
1107 * @type: device_type of the devices to iterate over, NULL for all
1108 *
1109 * Initialize subsys iterator @iter such that it iterates over devices
1110 * of @subsys. If @start is set, the list iteration will start there,
1111 * otherwise if it is NULL, the iteration starts at the beginning of
1112 * the list.
1113 */
1114void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys,
1115 struct device *start, const struct device_type *type)
1116{
1117 struct klist_node *start_knode = NULL;
1118
1119 if (start)
1120 start_knode = &start->p->knode_bus;
1121 klist_iter_init_node(&subsys->p->klist_devices, &iter->ki, start_knode);
1122 iter->type = type;
1123}
1124EXPORT_SYMBOL_GPL(subsys_dev_iter_init);
1125
1126/**
1127 * subsys_dev_iter_next - iterate to the next device
1128 * @iter: subsys iterator to proceed
1129 *
1130 * Proceed @iter to the next device and return it. Returns NULL if
1131 * iteration is complete.
1132 *
1133 * The returned device is referenced and won't be released till
1134 * iterator is proceed to the next device or exited. The caller is
1135 * free to do whatever it wants to do with the device including
1136 * calling back into subsys code.
1137 */
1138struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
1139{
1140 struct klist_node *knode;
1141 struct device *dev;
1142
1143 for (;;) {
1144 knode = klist_next(&iter->ki);
1145 if (!knode)
1146 return NULL;
1147 dev = container_of(knode, struct device_private, knode_bus)->device;
1148 if (!iter->type || iter->type == dev->type)
1149 return dev;
1150 }
1151}
1152EXPORT_SYMBOL_GPL(subsys_dev_iter_next);
1153
1154/**
1155 * subsys_dev_iter_exit - finish iteration
1156 * @iter: subsys iterator to finish
1157 *
1158 * Finish an iteration. Always call this function after iteration is
1159 * complete whether the iteration ran till the end or not.
1160 */
1161void subsys_dev_iter_exit(struct subsys_dev_iter *iter)
1162{
1163 klist_iter_exit(&iter->ki);
1164}
1165EXPORT_SYMBOL_GPL(subsys_dev_iter_exit);
1166
1167int subsys_interface_register(struct subsys_interface *sif)
1168{
1169 struct bus_type *subsys;
1170 struct subsys_dev_iter iter;
1171 struct device *dev;
1172
1173 if (!sif || !sif->subsys)
1174 return -ENODEV;
1175
1176 subsys = bus_get(sif->subsys);
1177 if (!subsys)
1178 return -EINVAL;
1179
1180 mutex_lock(&subsys->p->mutex);
1181 list_add_tail(&sif->node, &subsys->p->interfaces);
1182 if (sif->add_dev) {
1183 subsys_dev_iter_init(&iter, subsys, NULL, NULL);
1184 while ((dev = subsys_dev_iter_next(&iter)))
1185 sif->add_dev(dev, sif);
1186 subsys_dev_iter_exit(&iter);
1187 }
1188 mutex_unlock(&subsys->p->mutex);
1189
1190 return 0;
1191}
1192EXPORT_SYMBOL_GPL(subsys_interface_register);
1193
1194void subsys_interface_unregister(struct subsys_interface *sif)
1195{
1196 struct bus_type *subsys = sif->subsys;
1197 struct subsys_dev_iter iter;
1198 struct device *dev;
1199
1200 if (!sif)
1201 return;
1202
1203 mutex_lock(&subsys->p->mutex);
1204 list_del_init(&sif->node);
1205 if (sif->remove_dev) {
1206 subsys_dev_iter_init(&iter, subsys, NULL, NULL);
1207 while ((dev = subsys_dev_iter_next(&iter)))
1208 sif->remove_dev(dev, sif);
1209 subsys_dev_iter_exit(&iter);
1210 }
1211 mutex_unlock(&subsys->p->mutex);
1212
1213 bus_put(subsys);
1214}
1215EXPORT_SYMBOL_GPL(subsys_interface_unregister);
1216
1217static void system_root_device_release(struct device *dev)
1218{
1219 kfree(dev);
1220}
1221/**
1222 * subsys_system_register - register a subsystem at /sys/devices/system/
1223 * @subsys - system subsystem
1224 * @groups - default attributes for the root device
1225 *
1226 * All 'system' subsystems have a /sys/devices/system/<name> root device
1227 * with the name of the subsystem. The root device can carry subsystem-
1228 * wide attributes. All registered devices are below this single root
1229 * device and are named after the subsystem with a simple enumeration
1230 * number appended. The registered devices are not explicitely named;
1231 * only 'id' in the device needs to be set.
1232 *
1233 * Do not use this interface for anything new, it exists for compatibility
1234 * with bad ideas only. New subsystems should use plain subsystems; and
1235 * add the subsystem-wide attributes should be added to the subsystem
1236 * directory itself and not some create fake root-device placed in
1237 * /sys/devices/system/<name>.
1238 */
1239int subsys_system_register(struct bus_type *subsys,
1240 const struct attribute_group **groups)
1241{
1242 struct device *dev;
1243 int err;
1244
1245 err = bus_register(subsys);
1246 if (err < 0)
1247 return err;
1248
1249 dev = kzalloc(sizeof(struct device), GFP_KERNEL);
1250 if (!dev) {
1251 err = -ENOMEM;
1252 goto err_dev;
1253 }
1254
1255 err = dev_set_name(dev, "%s", subsys->name);
1256 if (err < 0)
1257 goto err_name;
1258
1259 dev->kobj.parent = &system_kset->kobj;
1260 dev->groups = groups;
1261 dev->release = system_root_device_release;
1262
1263 err = device_register(dev);
1264 if (err < 0)
1265 goto err_dev_reg;
1266
1267 subsys->dev_root = dev;
1268 return 0;
1269
1270err_dev_reg:
1271 put_device(dev);
1272 dev = NULL;
1273err_name:
1274 kfree(dev);
1275err_dev:
1276 bus_unregister(subsys);
1277 return err;
1278}
1279EXPORT_SYMBOL_GPL(subsys_system_register);
1280
1031int __init buses_init(void) 1281int __init buses_init(void)
1032{ 1282{
1033 bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL); 1283 bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL);
1034 if (!bus_kset) 1284 if (!bus_kset)
1035 return -ENOMEM; 1285 return -ENOMEM;
1286
1287 system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj);
1288 if (!system_kset)
1289 return -ENOMEM;
1290
1036 return 0; 1291 return 0;
1037} 1292}
diff --git a/drivers/base/class.c b/drivers/base/class.c
index b80d91cc8c3a..03243d4002fd 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -184,9 +184,9 @@ int __class_register(struct class *cls, struct lock_class_key *key)
184 if (!cp) 184 if (!cp)
185 return -ENOMEM; 185 return -ENOMEM;
186 klist_init(&cp->klist_devices, klist_class_dev_get, klist_class_dev_put); 186 klist_init(&cp->klist_devices, klist_class_dev_get, klist_class_dev_put);
187 INIT_LIST_HEAD(&cp->class_interfaces); 187 INIT_LIST_HEAD(&cp->interfaces);
188 kset_init(&cp->glue_dirs); 188 kset_init(&cp->glue_dirs);
189 __mutex_init(&cp->class_mutex, "struct class mutex", key); 189 __mutex_init(&cp->mutex, "subsys mutex", key);
190 error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name); 190 error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name);
191 if (error) { 191 if (error) {
192 kfree(cp); 192 kfree(cp);
@@ -460,15 +460,15 @@ int class_interface_register(struct class_interface *class_intf)
460 if (!parent) 460 if (!parent)
461 return -EINVAL; 461 return -EINVAL;
462 462
463 mutex_lock(&parent->p->class_mutex); 463 mutex_lock(&parent->p->mutex);
464 list_add_tail(&class_intf->node, &parent->p->class_interfaces); 464 list_add_tail(&class_intf->node, &parent->p->interfaces);
465 if (class_intf->add_dev) { 465 if (class_intf->add_dev) {
466 class_dev_iter_init(&iter, parent, NULL, NULL); 466 class_dev_iter_init(&iter, parent, NULL, NULL);
467 while ((dev = class_dev_iter_next(&iter))) 467 while ((dev = class_dev_iter_next(&iter)))
468 class_intf->add_dev(dev, class_intf); 468 class_intf->add_dev(dev, class_intf);
469 class_dev_iter_exit(&iter); 469 class_dev_iter_exit(&iter);
470 } 470 }
471 mutex_unlock(&parent->p->class_mutex); 471 mutex_unlock(&parent->p->mutex);
472 472
473 return 0; 473 return 0;
474} 474}
@@ -482,7 +482,7 @@ void class_interface_unregister(struct class_interface *class_intf)
482 if (!parent) 482 if (!parent)
483 return; 483 return;
484 484
485 mutex_lock(&parent->p->class_mutex); 485 mutex_lock(&parent->p->mutex);
486 list_del_init(&class_intf->node); 486 list_del_init(&class_intf->node);
487 if (class_intf->remove_dev) { 487 if (class_intf->remove_dev) {
488 class_dev_iter_init(&iter, parent, NULL, NULL); 488 class_dev_iter_init(&iter, parent, NULL, NULL);
@@ -490,7 +490,7 @@ void class_interface_unregister(struct class_interface *class_intf)
490 class_intf->remove_dev(dev, class_intf); 490 class_intf->remove_dev(dev, class_intf);
491 class_dev_iter_exit(&iter); 491 class_dev_iter_exit(&iter);
492 } 492 }
493 mutex_unlock(&parent->p->class_mutex); 493 mutex_unlock(&parent->p->mutex);
494 494
495 class_put(parent); 495 class_put(parent);
496} 496}
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 919daa7cd5b1..4dac58aa4a0a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -118,6 +118,56 @@ static const struct sysfs_ops dev_sysfs_ops = {
118 .store = dev_attr_store, 118 .store = dev_attr_store,
119}; 119};
120 120
121#define to_ext_attr(x) container_of(x, struct dev_ext_attribute, attr)
122
123ssize_t device_store_ulong(struct device *dev,
124 struct device_attribute *attr,
125 const char *buf, size_t size)
126{
127 struct dev_ext_attribute *ea = to_ext_attr(attr);
128 char *end;
129 unsigned long new = simple_strtoul(buf, &end, 0);
130 if (end == buf)
131 return -EINVAL;
132 *(unsigned long *)(ea->var) = new;
133 /* Always return full write size even if we didn't consume all */
134 return size;
135}
136EXPORT_SYMBOL_GPL(device_store_ulong);
137
138ssize_t device_show_ulong(struct device *dev,
139 struct device_attribute *attr,
140 char *buf)
141{
142 struct dev_ext_attribute *ea = to_ext_attr(attr);
143 return snprintf(buf, PAGE_SIZE, "%lx\n", *(unsigned long *)(ea->var));
144}
145EXPORT_SYMBOL_GPL(device_show_ulong);
146
147ssize_t device_store_int(struct device *dev,
148 struct device_attribute *attr,
149 const char *buf, size_t size)
150{
151 struct dev_ext_attribute *ea = to_ext_attr(attr);
152 char *end;
153 long new = simple_strtol(buf, &end, 0);
154 if (end == buf || new > INT_MAX || new < INT_MIN)
155 return -EINVAL;
156 *(int *)(ea->var) = new;
157 /* Always return full write size even if we didn't consume all */
158 return size;
159}
160EXPORT_SYMBOL_GPL(device_store_int);
161
162ssize_t device_show_int(struct device *dev,
163 struct device_attribute *attr,
164 char *buf)
165{
166 struct dev_ext_attribute *ea = to_ext_attr(attr);
167
168 return snprintf(buf, PAGE_SIZE, "%d\n", *(int *)(ea->var));
169}
170EXPORT_SYMBOL_GPL(device_show_int);
121 171
122/** 172/**
123 * device_release - free device structure. 173 * device_release - free device structure.
@@ -464,7 +514,7 @@ static ssize_t show_dev(struct device *dev, struct device_attribute *attr,
464static struct device_attribute devt_attr = 514static struct device_attribute devt_attr =
465 __ATTR(dev, S_IRUGO, show_dev, NULL); 515 __ATTR(dev, S_IRUGO, show_dev, NULL);
466 516
467/* kset to create /sys/devices/ */ 517/* /sys/devices/ */
468struct kset *devices_kset; 518struct kset *devices_kset;
469 519
470/** 520/**
@@ -711,6 +761,10 @@ static struct kobject *get_device_parent(struct device *dev,
711 return k; 761 return k;
712 } 762 }
713 763
764 /* subsystems can specify a default root directory for their devices */
765 if (!parent && dev->bus && dev->bus->dev_root)
766 return &dev->bus->dev_root->kobj;
767
714 if (parent) 768 if (parent)
715 return &parent->kobj; 769 return &parent->kobj;
716 return NULL; 770 return NULL;
@@ -731,14 +785,6 @@ static void cleanup_device_parent(struct device *dev)
731 cleanup_glue_dir(dev, dev->kobj.parent); 785 cleanup_glue_dir(dev, dev->kobj.parent);
732} 786}
733 787
734static void setup_parent(struct device *dev, struct device *parent)
735{
736 struct kobject *kobj;
737 kobj = get_device_parent(dev, parent);
738 if (kobj)
739 dev->kobj.parent = kobj;
740}
741
742static int device_add_class_symlinks(struct device *dev) 788static int device_add_class_symlinks(struct device *dev)
743{ 789{
744 int error; 790 int error;
@@ -891,6 +937,7 @@ int device_private_init(struct device *dev)
891int device_add(struct device *dev) 937int device_add(struct device *dev)
892{ 938{
893 struct device *parent = NULL; 939 struct device *parent = NULL;
940 struct kobject *kobj;
894 struct class_interface *class_intf; 941 struct class_interface *class_intf;
895 int error = -EINVAL; 942 int error = -EINVAL;
896 943
@@ -914,6 +961,10 @@ int device_add(struct device *dev)
914 dev->init_name = NULL; 961 dev->init_name = NULL;
915 } 962 }
916 963
964 /* subsystems can specify simple device enumeration */
965 if (!dev_name(dev) && dev->bus && dev->bus->dev_name)
966 dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id);
967
917 if (!dev_name(dev)) { 968 if (!dev_name(dev)) {
918 error = -EINVAL; 969 error = -EINVAL;
919 goto name_error; 970 goto name_error;
@@ -922,7 +973,9 @@ int device_add(struct device *dev)
922 pr_debug("device: '%s': %s\n", dev_name(dev), __func__); 973 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
923 974
924 parent = get_device(dev->parent); 975 parent = get_device(dev->parent);
925 setup_parent(dev, parent); 976 kobj = get_device_parent(dev, parent);
977 if (kobj)
978 dev->kobj.parent = kobj;
926 979
927 /* use parent numa_node */ 980 /* use parent numa_node */
928 if (parent) 981 if (parent)
@@ -982,17 +1035,17 @@ int device_add(struct device *dev)
982 &parent->p->klist_children); 1035 &parent->p->klist_children);
983 1036
984 if (dev->class) { 1037 if (dev->class) {
985 mutex_lock(&dev->class->p->class_mutex); 1038 mutex_lock(&dev->class->p->mutex);
986 /* tie the class to the device */ 1039 /* tie the class to the device */
987 klist_add_tail(&dev->knode_class, 1040 klist_add_tail(&dev->knode_class,
988 &dev->class->p->klist_devices); 1041 &dev->class->p->klist_devices);
989 1042
990 /* notify any interfaces that the device is here */ 1043 /* notify any interfaces that the device is here */
991 list_for_each_entry(class_intf, 1044 list_for_each_entry(class_intf,
992 &dev->class->p->class_interfaces, node) 1045 &dev->class->p->interfaces, node)
993 if (class_intf->add_dev) 1046 if (class_intf->add_dev)
994 class_intf->add_dev(dev, class_intf); 1047 class_intf->add_dev(dev, class_intf);
995 mutex_unlock(&dev->class->p->class_mutex); 1048 mutex_unlock(&dev->class->p->mutex);
996 } 1049 }
997done: 1050done:
998 put_device(dev); 1051 put_device(dev);
@@ -1107,15 +1160,15 @@ void device_del(struct device *dev)
1107 if (dev->class) { 1160 if (dev->class) {
1108 device_remove_class_symlinks(dev); 1161 device_remove_class_symlinks(dev);
1109 1162
1110 mutex_lock(&dev->class->p->class_mutex); 1163 mutex_lock(&dev->class->p->mutex);
1111 /* notify any interfaces that the device is now gone */ 1164 /* notify any interfaces that the device is now gone */
1112 list_for_each_entry(class_intf, 1165 list_for_each_entry(class_intf,
1113 &dev->class->p->class_interfaces, node) 1166 &dev->class->p->interfaces, node)
1114 if (class_intf->remove_dev) 1167 if (class_intf->remove_dev)
1115 class_intf->remove_dev(dev, class_intf); 1168 class_intf->remove_dev(dev, class_intf);
1116 /* remove the device from the class list */ 1169 /* remove the device from the class list */
1117 klist_del(&dev->knode_class); 1170 klist_del(&dev->knode_class);
1118 mutex_unlock(&dev->class->p->class_mutex); 1171 mutex_unlock(&dev->class->p->mutex);
1119 } 1172 }
1120 device_remove_file(dev, &uevent_attr); 1173 device_remove_file(dev, &uevent_attr);
1121 device_remove_attrs(dev); 1174 device_remove_attrs(dev);
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 251acea3d359..5bb0298fbcc0 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * drivers/base/cpu.c - basic CPU class support 2 * CPU subsystem support
3 */ 3 */
4 4
5#include <linux/sysdev.h>
6#include <linux/module.h> 5#include <linux/module.h>
7#include <linux/init.h> 6#include <linux/init.h>
8#include <linux/sched.h> 7#include <linux/sched.h>
@@ -14,40 +13,40 @@
14 13
15#include "base.h" 14#include "base.h"
16 15
17static struct sysdev_class_attribute *cpu_sysdev_class_attrs[]; 16struct bus_type cpu_subsys = {
18
19struct sysdev_class cpu_sysdev_class = {
20 .name = "cpu", 17 .name = "cpu",
21 .attrs = cpu_sysdev_class_attrs, 18 .dev_name = "cpu",
22}; 19};
23EXPORT_SYMBOL(cpu_sysdev_class); 20EXPORT_SYMBOL_GPL(cpu_subsys);
24 21
25static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); 22static DEFINE_PER_CPU(struct device *, cpu_sys_devices);
26 23
27#ifdef CONFIG_HOTPLUG_CPU 24#ifdef CONFIG_HOTPLUG_CPU
28static ssize_t show_online(struct sys_device *dev, struct sysdev_attribute *attr, 25static ssize_t show_online(struct device *dev,
26 struct device_attribute *attr,
29 char *buf) 27 char *buf)
30{ 28{
31 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 29 struct cpu *cpu = container_of(dev, struct cpu, dev);
32 30
33 return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); 31 return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id));
34} 32}
35 33
36static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribute *attr, 34static ssize_t __ref store_online(struct device *dev,
37 const char *buf, size_t count) 35 struct device_attribute *attr,
36 const char *buf, size_t count)
38{ 37{
39 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 38 struct cpu *cpu = container_of(dev, struct cpu, dev);
40 ssize_t ret; 39 ssize_t ret;
41 40
42 cpu_hotplug_driver_lock(); 41 cpu_hotplug_driver_lock();
43 switch (buf[0]) { 42 switch (buf[0]) {
44 case '0': 43 case '0':
45 ret = cpu_down(cpu->sysdev.id); 44 ret = cpu_down(cpu->dev.id);
46 if (!ret) 45 if (!ret)
47 kobject_uevent(&dev->kobj, KOBJ_OFFLINE); 46 kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
48 break; 47 break;
49 case '1': 48 case '1':
50 ret = cpu_up(cpu->sysdev.id); 49 ret = cpu_up(cpu->dev.id);
51 if (!ret) 50 if (!ret)
52 kobject_uevent(&dev->kobj, KOBJ_ONLINE); 51 kobject_uevent(&dev->kobj, KOBJ_ONLINE);
53 break; 52 break;
@@ -60,44 +59,44 @@ static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribut
60 ret = count; 59 ret = count;
61 return ret; 60 return ret;
62} 61}
63static SYSDEV_ATTR(online, 0644, show_online, store_online); 62static DEVICE_ATTR(online, 0644, show_online, store_online);
64 63
65static void __cpuinit register_cpu_control(struct cpu *cpu) 64static void __cpuinit register_cpu_control(struct cpu *cpu)
66{ 65{
67 sysdev_create_file(&cpu->sysdev, &attr_online); 66 device_create_file(&cpu->dev, &dev_attr_online);
68} 67}
69void unregister_cpu(struct cpu *cpu) 68void unregister_cpu(struct cpu *cpu)
70{ 69{
71 int logical_cpu = cpu->sysdev.id; 70 int logical_cpu = cpu->dev.id;
72 71
73 unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu)); 72 unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu));
74 73
75 sysdev_remove_file(&cpu->sysdev, &attr_online); 74 device_remove_file(&cpu->dev, &dev_attr_online);
76 75
77 sysdev_unregister(&cpu->sysdev); 76 device_unregister(&cpu->dev);
78 per_cpu(cpu_sys_devices, logical_cpu) = NULL; 77 per_cpu(cpu_sys_devices, logical_cpu) = NULL;
79 return; 78 return;
80} 79}
81 80
82#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE 81#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
83static ssize_t cpu_probe_store(struct sysdev_class *class, 82static ssize_t cpu_probe_store(struct device *dev,
84 struct sysdev_class_attribute *attr, 83 struct device_attribute *attr,
85 const char *buf, 84 const char *buf,
86 size_t count) 85 size_t count)
87{ 86{
88 return arch_cpu_probe(buf, count); 87 return arch_cpu_probe(buf, count);
89} 88}
90 89
91static ssize_t cpu_release_store(struct sysdev_class *class, 90static ssize_t cpu_release_store(struct device *dev,
92 struct sysdev_class_attribute *attr, 91 struct device_attribute *attr,
93 const char *buf, 92 const char *buf,
94 size_t count) 93 size_t count)
95{ 94{
96 return arch_cpu_release(buf, count); 95 return arch_cpu_release(buf, count);
97} 96}
98 97
99static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); 98static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
100static SYSDEV_CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); 99static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
101#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ 100#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
102 101
103#else /* ... !CONFIG_HOTPLUG_CPU */ 102#else /* ... !CONFIG_HOTPLUG_CPU */
@@ -109,15 +108,15 @@ static inline void register_cpu_control(struct cpu *cpu)
109#ifdef CONFIG_KEXEC 108#ifdef CONFIG_KEXEC
110#include <linux/kexec.h> 109#include <linux/kexec.h>
111 110
112static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute *attr, 111static ssize_t show_crash_notes(struct device *dev, struct device_attribute *attr,
113 char *buf) 112 char *buf)
114{ 113{
115 struct cpu *cpu = container_of(dev, struct cpu, sysdev); 114 struct cpu *cpu = container_of(dev, struct cpu, dev);
116 ssize_t rc; 115 ssize_t rc;
117 unsigned long long addr; 116 unsigned long long addr;
118 int cpunum; 117 int cpunum;
119 118
120 cpunum = cpu->sysdev.id; 119 cpunum = cpu->dev.id;
121 120
122 /* 121 /*
123 * Might be reading other cpu's data based on which cpu read thread 122 * Might be reading other cpu's data based on which cpu read thread
@@ -129,7 +128,7 @@ static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute
129 rc = sprintf(buf, "%Lx\n", addr); 128 rc = sprintf(buf, "%Lx\n", addr);
130 return rc; 129 return rc;
131} 130}
132static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); 131static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL);
133#endif 132#endif
134 133
135/* 134/*
@@ -137,12 +136,12 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL);
137 */ 136 */
138 137
139struct cpu_attr { 138struct cpu_attr {
140 struct sysdev_class_attribute attr; 139 struct device_attribute attr;
141 const struct cpumask *const * const map; 140 const struct cpumask *const * const map;
142}; 141};
143 142
144static ssize_t show_cpus_attr(struct sysdev_class *class, 143static ssize_t show_cpus_attr(struct device *dev,
145 struct sysdev_class_attribute *attr, 144 struct device_attribute *attr,
146 char *buf) 145 char *buf)
147{ 146{
148 struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr); 147 struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr);
@@ -153,10 +152,10 @@ static ssize_t show_cpus_attr(struct sysdev_class *class,
153 return n; 152 return n;
154} 153}
155 154
156#define _CPU_ATTR(name, map) \ 155#define _CPU_ATTR(name, map) \
157 { _SYSDEV_CLASS_ATTR(name, 0444, show_cpus_attr, NULL), map } 156 { __ATTR(name, 0444, show_cpus_attr, NULL), map }
158 157
159/* Keep in sync with cpu_sysdev_class_attrs */ 158/* Keep in sync with cpu_subsys_attrs */
160static struct cpu_attr cpu_attrs[] = { 159static struct cpu_attr cpu_attrs[] = {
161 _CPU_ATTR(online, &cpu_online_mask), 160 _CPU_ATTR(online, &cpu_online_mask),
162 _CPU_ATTR(possible, &cpu_possible_mask), 161 _CPU_ATTR(possible, &cpu_possible_mask),
@@ -166,19 +165,19 @@ static struct cpu_attr cpu_attrs[] = {
166/* 165/*
167 * Print values for NR_CPUS and offlined cpus 166 * Print values for NR_CPUS and offlined cpus
168 */ 167 */
169static ssize_t print_cpus_kernel_max(struct sysdev_class *class, 168static ssize_t print_cpus_kernel_max(struct device *dev,
170 struct sysdev_class_attribute *attr, char *buf) 169 struct device_attribute *attr, char *buf)
171{ 170{
172 int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); 171 int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1);
173 return n; 172 return n;
174} 173}
175static SYSDEV_CLASS_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); 174static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL);
176 175
177/* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ 176/* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */
178unsigned int total_cpus; 177unsigned int total_cpus;
179 178
180static ssize_t print_cpus_offline(struct sysdev_class *class, 179static ssize_t print_cpus_offline(struct device *dev,
181 struct sysdev_class_attribute *attr, char *buf) 180 struct device_attribute *attr, char *buf)
182{ 181{
183 int n = 0, len = PAGE_SIZE-2; 182 int n = 0, len = PAGE_SIZE-2;
184 cpumask_var_t offline; 183 cpumask_var_t offline;
@@ -205,7 +204,7 @@ static ssize_t print_cpus_offline(struct sysdev_class *class,
205 n += snprintf(&buf[n], len - n, "\n"); 204 n += snprintf(&buf[n], len - n, "\n");
206 return n; 205 return n;
207} 206}
208static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); 207static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
209 208
210/* 209/*
211 * register_cpu - Setup a sysfs device for a CPU. 210 * register_cpu - Setup a sysfs device for a CPU.
@@ -218,57 +217,66 @@ static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL);
218int __cpuinit register_cpu(struct cpu *cpu, int num) 217int __cpuinit register_cpu(struct cpu *cpu, int num)
219{ 218{
220 int error; 219 int error;
221 cpu->node_id = cpu_to_node(num);
222 cpu->sysdev.id = num;
223 cpu->sysdev.cls = &cpu_sysdev_class;
224
225 error = sysdev_register(&cpu->sysdev);
226 220
221 cpu->node_id = cpu_to_node(num);
222 cpu->dev.id = num;
223 cpu->dev.bus = &cpu_subsys;
224 error = device_register(&cpu->dev);
227 if (!error && cpu->hotpluggable) 225 if (!error && cpu->hotpluggable)
228 register_cpu_control(cpu); 226 register_cpu_control(cpu);
229 if (!error) 227 if (!error)
230 per_cpu(cpu_sys_devices, num) = &cpu->sysdev; 228 per_cpu(cpu_sys_devices, num) = &cpu->dev;
231 if (!error) 229 if (!error)
232 register_cpu_under_node(num, cpu_to_node(num)); 230 register_cpu_under_node(num, cpu_to_node(num));
233 231
234#ifdef CONFIG_KEXEC 232#ifdef CONFIG_KEXEC
235 if (!error) 233 if (!error)
236 error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes); 234 error = device_create_file(&cpu->dev, &dev_attr_crash_notes);
237#endif 235#endif
238 return error; 236 return error;
239} 237}
240 238
241struct sys_device *get_cpu_sysdev(unsigned cpu) 239struct device *get_cpu_device(unsigned cpu)
242{ 240{
243 if (cpu < nr_cpu_ids && cpu_possible(cpu)) 241 if (cpu < nr_cpu_ids && cpu_possible(cpu))
244 return per_cpu(cpu_sys_devices, cpu); 242 return per_cpu(cpu_sys_devices, cpu);
245 else 243 else
246 return NULL; 244 return NULL;
247} 245}
248EXPORT_SYMBOL_GPL(get_cpu_sysdev); 246EXPORT_SYMBOL_GPL(get_cpu_device);
247
248static struct attribute *cpu_root_attrs[] = {
249#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
250 &dev_attr_probe.attr,
251 &dev_attr_release.attr,
252#endif
253 &cpu_attrs[0].attr.attr,
254 &cpu_attrs[1].attr.attr,
255 &cpu_attrs[2].attr.attr,
256 &dev_attr_kernel_max.attr,
257 &dev_attr_offline.attr,
258 NULL
259};
260
261static struct attribute_group cpu_root_attr_group = {
262 .attrs = cpu_root_attrs,
263};
264
265static const struct attribute_group *cpu_root_attr_groups[] = {
266 &cpu_root_attr_group,
267 NULL,
268};
249 269
250int __init cpu_dev_init(void) 270int __init cpu_dev_init(void)
251{ 271{
252 int err; 272 int err;
253 273
254 err = sysdev_class_register(&cpu_sysdev_class); 274 err = subsys_system_register(&cpu_subsys, cpu_root_attr_groups);
275 if (err)
276 return err;
277
255#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) 278#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
256 if (!err) 279 err = sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root);
257 err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class);
258#endif 280#endif
259
260 return err; 281 return err;
261} 282}
262
263static struct sysdev_class_attribute *cpu_sysdev_class_attrs[] = {
264#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
265 &attr_probe,
266 &attr_release,
267#endif
268 &cpu_attrs[0].attr,
269 &cpu_attrs[1].attr,
270 &cpu_attrs[2].attr,
271 &attr_kernel_max,
272 &attr_offline,
273 NULL
274};
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index a4760e095ff5..2bb4bff3af7d 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -413,10 +413,9 @@ static int devtmpfsd(void *p)
413 } 413 }
414 spin_lock(&req_lock); 414 spin_lock(&req_lock);
415 } 415 }
416 set_current_state(TASK_INTERRUPTIBLE); 416 __set_current_state(TASK_INTERRUPTIBLE);
417 spin_unlock(&req_lock); 417 spin_unlock(&req_lock);
418 schedule(); 418 schedule();
419 __set_current_state(TASK_RUNNING);
420 } 419 }
421 return 0; 420 return 0;
422out: 421out:
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 06ed6b4e7df5..3719c94be19c 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -226,13 +226,13 @@ static ssize_t firmware_loading_store(struct device *dev,
226 int loading = simple_strtol(buf, NULL, 10); 226 int loading = simple_strtol(buf, NULL, 10);
227 int i; 227 int i;
228 228
229 mutex_lock(&fw_lock);
230
231 if (!fw_priv->fw)
232 goto out;
233
229 switch (loading) { 234 switch (loading) {
230 case 1: 235 case 1:
231 mutex_lock(&fw_lock);
232 if (!fw_priv->fw) {
233 mutex_unlock(&fw_lock);
234 break;
235 }
236 firmware_free_data(fw_priv->fw); 236 firmware_free_data(fw_priv->fw);
237 memset(fw_priv->fw, 0, sizeof(struct firmware)); 237 memset(fw_priv->fw, 0, sizeof(struct firmware));
238 /* If the pages are not owned by 'struct firmware' */ 238 /* If the pages are not owned by 'struct firmware' */
@@ -243,7 +243,6 @@ static ssize_t firmware_loading_store(struct device *dev,
243 fw_priv->page_array_size = 0; 243 fw_priv->page_array_size = 0;
244 fw_priv->nr_pages = 0; 244 fw_priv->nr_pages = 0;
245 set_bit(FW_STATUS_LOADING, &fw_priv->status); 245 set_bit(FW_STATUS_LOADING, &fw_priv->status);
246 mutex_unlock(&fw_lock);
247 break; 246 break;
248 case 0: 247 case 0:
249 if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) { 248 if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
@@ -274,7 +273,8 @@ static ssize_t firmware_loading_store(struct device *dev,
274 fw_load_abort(fw_priv); 273 fw_load_abort(fw_priv);
275 break; 274 break;
276 } 275 }
277 276out:
277 mutex_unlock(&fw_lock);
278 return count; 278 return count;
279} 279}
280 280
diff --git a/drivers/base/init.c b/drivers/base/init.c
index c8a934e79421..c16f0b808a17 100644
--- a/drivers/base/init.c
+++ b/drivers/base/init.c
@@ -31,7 +31,6 @@ void __init driver_init(void)
31 * core core pieces. 31 * core core pieces.
32 */ 32 */
33 platform_bus_init(); 33 platform_bus_init();
34 system_bus_init();
35 cpu_dev_init(); 34 cpu_dev_init();
36 memory_dev_init(); 35 memory_dev_init();
37} 36}
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 8272d92d22c0..f17e3ea041c0 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * drivers/base/memory.c - basic Memory class support 2 * Memory subsystem support
3 * 3 *
4 * Written by Matt Tolentino <matthew.e.tolentino@intel.com> 4 * Written by Matt Tolentino <matthew.e.tolentino@intel.com>
5 * Dave Hansen <haveblue@us.ibm.com> 5 * Dave Hansen <haveblue@us.ibm.com>
@@ -10,7 +10,6 @@
10 * SPARSEMEM should be contained here, or in mm/memory_hotplug.c. 10 * SPARSEMEM should be contained here, or in mm/memory_hotplug.c.
11 */ 11 */
12 12
13#include <linux/sysdev.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/topology.h> 15#include <linux/topology.h>
@@ -38,26 +37,9 @@ static inline int base_memory_block_id(int section_nr)
38 return section_nr / sections_per_block; 37 return section_nr / sections_per_block;
39} 38}
40 39
41static struct sysdev_class memory_sysdev_class = { 40static struct bus_type memory_subsys = {
42 .name = MEMORY_CLASS_NAME, 41 .name = MEMORY_CLASS_NAME,
43}; 42 .dev_name = MEMORY_CLASS_NAME,
44
45static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
46{
47 return MEMORY_CLASS_NAME;
48}
49
50static int memory_uevent(struct kset *kset, struct kobject *obj,
51 struct kobj_uevent_env *env)
52{
53 int retval = 0;
54
55 return retval;
56}
57
58static const struct kset_uevent_ops memory_uevent_ops = {
59 .name = memory_uevent_name,
60 .uevent = memory_uevent,
61}; 43};
62 44
63static BLOCKING_NOTIFIER_HEAD(memory_chain); 45static BLOCKING_NOTIFIER_HEAD(memory_chain);
@@ -96,21 +78,21 @@ int register_memory(struct memory_block *memory)
96{ 78{
97 int error; 79 int error;
98 80
99 memory->sysdev.cls = &memory_sysdev_class; 81 memory->dev.bus = &memory_subsys;
100 memory->sysdev.id = memory->start_section_nr / sections_per_block; 82 memory->dev.id = memory->start_section_nr / sections_per_block;
101 83
102 error = sysdev_register(&memory->sysdev); 84 error = device_register(&memory->dev);
103 return error; 85 return error;
104} 86}
105 87
106static void 88static void
107unregister_memory(struct memory_block *memory) 89unregister_memory(struct memory_block *memory)
108{ 90{
109 BUG_ON(memory->sysdev.cls != &memory_sysdev_class); 91 BUG_ON(memory->dev.bus != &memory_subsys);
110 92
111 /* drop the ref. we got in remove_memory_block() */ 93 /* drop the ref. we got in remove_memory_block() */
112 kobject_put(&memory->sysdev.kobj); 94 kobject_put(&memory->dev.kobj);
113 sysdev_unregister(&memory->sysdev); 95 device_unregister(&memory->dev);
114} 96}
115 97
116unsigned long __weak memory_block_size_bytes(void) 98unsigned long __weak memory_block_size_bytes(void)
@@ -138,22 +120,22 @@ static unsigned long get_memory_block_size(void)
138 * uses. 120 * uses.
139 */ 121 */
140 122
141static ssize_t show_mem_start_phys_index(struct sys_device *dev, 123static ssize_t show_mem_start_phys_index(struct device *dev,
142 struct sysdev_attribute *attr, char *buf) 124 struct device_attribute *attr, char *buf)
143{ 125{
144 struct memory_block *mem = 126 struct memory_block *mem =
145 container_of(dev, struct memory_block, sysdev); 127 container_of(dev, struct memory_block, dev);
146 unsigned long phys_index; 128 unsigned long phys_index;
147 129
148 phys_index = mem->start_section_nr / sections_per_block; 130 phys_index = mem->start_section_nr / sections_per_block;
149 return sprintf(buf, "%08lx\n", phys_index); 131 return sprintf(buf, "%08lx\n", phys_index);
150} 132}
151 133
152static ssize_t show_mem_end_phys_index(struct sys_device *dev, 134static ssize_t show_mem_end_phys_index(struct device *dev,
153 struct sysdev_attribute *attr, char *buf) 135 struct device_attribute *attr, char *buf)
154{ 136{
155 struct memory_block *mem = 137 struct memory_block *mem =
156 container_of(dev, struct memory_block, sysdev); 138 container_of(dev, struct memory_block, dev);
157 unsigned long phys_index; 139 unsigned long phys_index;
158 140
159 phys_index = mem->end_section_nr / sections_per_block; 141 phys_index = mem->end_section_nr / sections_per_block;
@@ -163,13 +145,13 @@ static ssize_t show_mem_end_phys_index(struct sys_device *dev,
163/* 145/*
164 * Show whether the section of memory is likely to be hot-removable 146 * Show whether the section of memory is likely to be hot-removable
165 */ 147 */
166static ssize_t show_mem_removable(struct sys_device *dev, 148static ssize_t show_mem_removable(struct device *dev,
167 struct sysdev_attribute *attr, char *buf) 149 struct device_attribute *attr, char *buf)
168{ 150{
169 unsigned long i, pfn; 151 unsigned long i, pfn;
170 int ret = 1; 152 int ret = 1;
171 struct memory_block *mem = 153 struct memory_block *mem =
172 container_of(dev, struct memory_block, sysdev); 154 container_of(dev, struct memory_block, dev);
173 155
174 for (i = 0; i < sections_per_block; i++) { 156 for (i = 0; i < sections_per_block; i++) {
175 pfn = section_nr_to_pfn(mem->start_section_nr + i); 157 pfn = section_nr_to_pfn(mem->start_section_nr + i);
@@ -182,11 +164,11 @@ static ssize_t show_mem_removable(struct sys_device *dev,
182/* 164/*
183 * online, offline, going offline, etc. 165 * online, offline, going offline, etc.
184 */ 166 */
185static ssize_t show_mem_state(struct sys_device *dev, 167static ssize_t show_mem_state(struct device *dev,
186 struct sysdev_attribute *attr, char *buf) 168 struct device_attribute *attr, char *buf)
187{ 169{
188 struct memory_block *mem = 170 struct memory_block *mem =
189 container_of(dev, struct memory_block, sysdev); 171 container_of(dev, struct memory_block, dev);
190 ssize_t len = 0; 172 ssize_t len = 0;
191 173
192 /* 174 /*
@@ -324,13 +306,13 @@ out:
324} 306}
325 307
326static ssize_t 308static ssize_t
327store_mem_state(struct sys_device *dev, 309store_mem_state(struct device *dev,
328 struct sysdev_attribute *attr, const char *buf, size_t count) 310 struct device_attribute *attr, const char *buf, size_t count)
329{ 311{
330 struct memory_block *mem; 312 struct memory_block *mem;
331 int ret = -EINVAL; 313 int ret = -EINVAL;
332 314
333 mem = container_of(dev, struct memory_block, sysdev); 315 mem = container_of(dev, struct memory_block, dev);
334 316
335 if (!strncmp(buf, "online", min((int)count, 6))) 317 if (!strncmp(buf, "online", min((int)count, 6)))
336 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); 318 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE);
@@ -351,41 +333,41 @@ store_mem_state(struct sys_device *dev,
351 * s.t. if I offline all of these sections I can then 333 * s.t. if I offline all of these sections I can then
352 * remove the physical device? 334 * remove the physical device?
353 */ 335 */
354static ssize_t show_phys_device(struct sys_device *dev, 336static ssize_t show_phys_device(struct device *dev,
355 struct sysdev_attribute *attr, char *buf) 337 struct device_attribute *attr, char *buf)
356{ 338{
357 struct memory_block *mem = 339 struct memory_block *mem =
358 container_of(dev, struct memory_block, sysdev); 340 container_of(dev, struct memory_block, dev);
359 return sprintf(buf, "%d\n", mem->phys_device); 341 return sprintf(buf, "%d\n", mem->phys_device);
360} 342}
361 343
362static SYSDEV_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL); 344static DEVICE_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL);
363static SYSDEV_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL); 345static DEVICE_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL);
364static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state); 346static DEVICE_ATTR(state, 0644, show_mem_state, store_mem_state);
365static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL); 347static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL);
366static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL); 348static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL);
367 349
368#define mem_create_simple_file(mem, attr_name) \ 350#define mem_create_simple_file(mem, attr_name) \
369 sysdev_create_file(&mem->sysdev, &attr_##attr_name) 351 device_create_file(&mem->dev, &dev_attr_##attr_name)
370#define mem_remove_simple_file(mem, attr_name) \ 352#define mem_remove_simple_file(mem, attr_name) \
371 sysdev_remove_file(&mem->sysdev, &attr_##attr_name) 353 device_remove_file(&mem->dev, &dev_attr_##attr_name)
372 354
373/* 355/*
374 * Block size attribute stuff 356 * Block size attribute stuff
375 */ 357 */
376static ssize_t 358static ssize_t
377print_block_size(struct sysdev_class *class, struct sysdev_class_attribute *attr, 359print_block_size(struct device *dev, struct device_attribute *attr,
378 char *buf) 360 char *buf)
379{ 361{
380 return sprintf(buf, "%lx\n", get_memory_block_size()); 362 return sprintf(buf, "%lx\n", get_memory_block_size());
381} 363}
382 364
383static SYSDEV_CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); 365static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL);
384 366
385static int block_size_init(void) 367static int block_size_init(void)
386{ 368{
387 return sysfs_create_file(&memory_sysdev_class.kset.kobj, 369 return device_create_file(memory_subsys.dev_root,
388 &attr_block_size_bytes.attr); 370 &dev_attr_block_size_bytes);
389} 371}
390 372
391/* 373/*
@@ -396,7 +378,7 @@ static int block_size_init(void)
396 */ 378 */
397#ifdef CONFIG_ARCH_MEMORY_PROBE 379#ifdef CONFIG_ARCH_MEMORY_PROBE
398static ssize_t 380static ssize_t
399memory_probe_store(struct class *class, struct class_attribute *attr, 381memory_probe_store(struct device *dev, struct device_attribute *attr,
400 const char *buf, size_t count) 382 const char *buf, size_t count)
401{ 383{
402 u64 phys_addr; 384 u64 phys_addr;
@@ -423,12 +405,11 @@ memory_probe_store(struct class *class, struct class_attribute *attr,
423out: 405out:
424 return ret; 406 return ret;
425} 407}
426static CLASS_ATTR(probe, S_IWUSR, NULL, memory_probe_store); 408static DEVICE_ATTR(probe, S_IWUSR, NULL, memory_probe_store);
427 409
428static int memory_probe_init(void) 410static int memory_probe_init(void)
429{ 411{
430 return sysfs_create_file(&memory_sysdev_class.kset.kobj, 412 return device_create_file(memory_subsys.dev_root, &dev_attr_probe);
431 &class_attr_probe.attr);
432} 413}
433#else 414#else
434static inline int memory_probe_init(void) 415static inline int memory_probe_init(void)
@@ -444,8 +425,8 @@ static inline int memory_probe_init(void)
444 425
445/* Soft offline a page */ 426/* Soft offline a page */
446static ssize_t 427static ssize_t
447store_soft_offline_page(struct class *class, 428store_soft_offline_page(struct device *dev,
448 struct class_attribute *attr, 429 struct device_attribute *attr,
449 const char *buf, size_t count) 430 const char *buf, size_t count)
450{ 431{
451 int ret; 432 int ret;
@@ -463,8 +444,8 @@ store_soft_offline_page(struct class *class,
463 444
464/* Forcibly offline a page, including killing processes. */ 445/* Forcibly offline a page, including killing processes. */
465static ssize_t 446static ssize_t
466store_hard_offline_page(struct class *class, 447store_hard_offline_page(struct device *dev,
467 struct class_attribute *attr, 448 struct device_attribute *attr,
468 const char *buf, size_t count) 449 const char *buf, size_t count)
469{ 450{
470 int ret; 451 int ret;
@@ -478,18 +459,18 @@ store_hard_offline_page(struct class *class,
478 return ret ? ret : count; 459 return ret ? ret : count;
479} 460}
480 461
481static CLASS_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page); 462static DEVICE_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page);
482static CLASS_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page); 463static DEVICE_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page);
483 464
484static __init int memory_fail_init(void) 465static __init int memory_fail_init(void)
485{ 466{
486 int err; 467 int err;
487 468
488 err = sysfs_create_file(&memory_sysdev_class.kset.kobj, 469 err = device_create_file(memory_subsys.dev_root,
489 &class_attr_soft_offline_page.attr); 470 &dev_attr_soft_offline_page);
490 if (!err) 471 if (!err)
491 err = sysfs_create_file(&memory_sysdev_class.kset.kobj, 472 err = device_create_file(memory_subsys.dev_root,
492 &class_attr_hard_offline_page.attr); 473 &dev_attr_hard_offline_page);
493 return err; 474 return err;
494} 475}
495#else 476#else
@@ -509,31 +490,23 @@ int __weak arch_get_memory_phys_device(unsigned long start_pfn)
509 return 0; 490 return 0;
510} 491}
511 492
493/*
494 * A reference for the returned object is held and the reference for the
495 * hinted object is released.
496 */
512struct memory_block *find_memory_block_hinted(struct mem_section *section, 497struct memory_block *find_memory_block_hinted(struct mem_section *section,
513 struct memory_block *hint) 498 struct memory_block *hint)
514{ 499{
515 struct kobject *kobj;
516 struct sys_device *sysdev;
517 struct memory_block *mem;
518 char name[sizeof(MEMORY_CLASS_NAME) + 9 + 1];
519 int block_id = base_memory_block_id(__section_nr(section)); 500 int block_id = base_memory_block_id(__section_nr(section));
501 struct device *hintdev = hint ? &hint->dev : NULL;
502 struct device *dev;
520 503
521 kobj = hint ? &hint->sysdev.kobj : NULL; 504 dev = subsys_find_device_by_id(&memory_subsys, block_id, hintdev);
522 505 if (hint)
523 /* 506 put_device(&hint->dev);
524 * This only works because we know that section == sysdev->id 507 if (!dev)
525 * slightly redundant with sysdev_register()
526 */
527 sprintf(&name[0], "%s%d", MEMORY_CLASS_NAME, block_id);
528
529 kobj = kset_find_obj_hinted(&memory_sysdev_class.kset, name, kobj);
530 if (!kobj)
531 return NULL; 508 return NULL;
532 509 return container_of(dev, struct memory_block, dev);
533 sysdev = container_of(kobj, struct sys_device, kobj);
534 mem = container_of(sysdev, struct memory_block, sysdev);
535
536 return mem;
537} 510}
538 511
539/* 512/*
@@ -542,7 +515,7 @@ struct memory_block *find_memory_block_hinted(struct mem_section *section,
542 * this gets to be a real problem, we can always use a radix 515 * this gets to be a real problem, we can always use a radix
543 * tree or something here. 516 * tree or something here.
544 * 517 *
545 * This could be made generic for all sysdev classes. 518 * This could be made generic for all device subsystems.
546 */ 519 */
547struct memory_block *find_memory_block(struct mem_section *section) 520struct memory_block *find_memory_block(struct mem_section *section)
548{ 521{
@@ -598,7 +571,7 @@ static int add_memory_section(int nid, struct mem_section *section,
598 mem = find_memory_block(section); 571 mem = find_memory_block(section);
599 if (mem) { 572 if (mem) {
600 mem->section_count++; 573 mem->section_count++;
601 kobject_put(&mem->sysdev.kobj); 574 kobject_put(&mem->dev.kobj);
602 } else 575 } else
603 ret = init_memory_block(&mem, section, state); 576 ret = init_memory_block(&mem, section, state);
604 577
@@ -631,7 +604,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,
631 unregister_memory(mem); 604 unregister_memory(mem);
632 kfree(mem); 605 kfree(mem);
633 } else 606 } else
634 kobject_put(&mem->sysdev.kobj); 607 kobject_put(&mem->dev.kobj);
635 608
636 mutex_unlock(&mem_sysfs_mutex); 609 mutex_unlock(&mem_sysfs_mutex);
637 return 0; 610 return 0;
@@ -664,8 +637,7 @@ int __init memory_dev_init(void)
664 int err; 637 int err;
665 unsigned long block_sz; 638 unsigned long block_sz;
666 639
667 memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops; 640 ret = subsys_system_register(&memory_subsys, NULL);
668 ret = sysdev_class_register(&memory_sysdev_class);
669 if (ret) 641 if (ret)
670 goto out; 642 goto out;
671 643
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 5693ecee9a40..44f427a66117 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * drivers/base/node.c - basic Node class support 2 * Basic Node interface support
3 */ 3 */
4 4
5#include <linux/sysdev.h>
6#include <linux/module.h> 5#include <linux/module.h>
7#include <linux/init.h> 6#include <linux/init.h>
8#include <linux/mm.h> 7#include <linux/mm.h>
@@ -19,18 +18,16 @@
19#include <linux/swap.h> 18#include <linux/swap.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
21 20
22static struct sysdev_class_attribute *node_state_attrs[]; 21static struct bus_type node_subsys = {
23
24static struct sysdev_class node_class = {
25 .name = "node", 22 .name = "node",
26 .attrs = node_state_attrs, 23 .dev_name = "node",
27}; 24};
28 25
29 26
30static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf) 27static ssize_t node_read_cpumap(struct device *dev, int type, char *buf)
31{ 28{
32 struct node *node_dev = to_node(dev); 29 struct node *node_dev = to_node(dev);
33 const struct cpumask *mask = cpumask_of_node(node_dev->sysdev.id); 30 const struct cpumask *mask = cpumask_of_node(node_dev->dev.id);
34 int len; 31 int len;
35 32
36 /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */ 33 /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */
@@ -44,23 +41,23 @@ static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf)
44 return len; 41 return len;
45} 42}
46 43
47static inline ssize_t node_read_cpumask(struct sys_device *dev, 44static inline ssize_t node_read_cpumask(struct device *dev,
48 struct sysdev_attribute *attr, char *buf) 45 struct device_attribute *attr, char *buf)
49{ 46{
50 return node_read_cpumap(dev, 0, buf); 47 return node_read_cpumap(dev, 0, buf);
51} 48}
52static inline ssize_t node_read_cpulist(struct sys_device *dev, 49static inline ssize_t node_read_cpulist(struct device *dev,
53 struct sysdev_attribute *attr, char *buf) 50 struct device_attribute *attr, char *buf)
54{ 51{
55 return node_read_cpumap(dev, 1, buf); 52 return node_read_cpumap(dev, 1, buf);
56} 53}
57 54
58static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); 55static DEVICE_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL);
59static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); 56static DEVICE_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL);
60 57
61#define K(x) ((x) << (PAGE_SHIFT - 10)) 58#define K(x) ((x) << (PAGE_SHIFT - 10))
62static ssize_t node_read_meminfo(struct sys_device * dev, 59static ssize_t node_read_meminfo(struct device *dev,
63 struct sysdev_attribute *attr, char * buf) 60 struct device_attribute *attr, char *buf)
64{ 61{
65 int n; 62 int n;
66 int nid = dev->id; 63 int nid = dev->id;
@@ -157,10 +154,10 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
157} 154}
158 155
159#undef K 156#undef K
160static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); 157static DEVICE_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL);
161 158
162static ssize_t node_read_numastat(struct sys_device * dev, 159static ssize_t node_read_numastat(struct device *dev,
163 struct sysdev_attribute *attr, char * buf) 160 struct device_attribute *attr, char *buf)
164{ 161{
165 return sprintf(buf, 162 return sprintf(buf,
166 "numa_hit %lu\n" 163 "numa_hit %lu\n"
@@ -176,10 +173,10 @@ static ssize_t node_read_numastat(struct sys_device * dev,
176 node_page_state(dev->id, NUMA_LOCAL), 173 node_page_state(dev->id, NUMA_LOCAL),
177 node_page_state(dev->id, NUMA_OTHER)); 174 node_page_state(dev->id, NUMA_OTHER));
178} 175}
179static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); 176static DEVICE_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
180 177
181static ssize_t node_read_vmstat(struct sys_device *dev, 178static ssize_t node_read_vmstat(struct device *dev,
182 struct sysdev_attribute *attr, char *buf) 179 struct device_attribute *attr, char *buf)
183{ 180{
184 int nid = dev->id; 181 int nid = dev->id;
185 int i; 182 int i;
@@ -191,10 +188,10 @@ static ssize_t node_read_vmstat(struct sys_device *dev,
191 188
192 return n; 189 return n;
193} 190}
194static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); 191static DEVICE_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);
195 192
196static ssize_t node_read_distance(struct sys_device * dev, 193static ssize_t node_read_distance(struct device *dev,
197 struct sysdev_attribute *attr, char * buf) 194 struct device_attribute *attr, char * buf)
198{ 195{
199 int nid = dev->id; 196 int nid = dev->id;
200 int len = 0; 197 int len = 0;
@@ -212,7 +209,7 @@ static ssize_t node_read_distance(struct sys_device * dev,
212 len += sprintf(buf + len, "\n"); 209 len += sprintf(buf + len, "\n");
213 return len; 210 return len;
214} 211}
215static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL); 212static DEVICE_ATTR(distance, S_IRUGO, node_read_distance, NULL);
216 213
217#ifdef CONFIG_HUGETLBFS 214#ifdef CONFIG_HUGETLBFS
218/* 215/*
@@ -230,7 +227,7 @@ static node_registration_func_t __hugetlb_unregister_node;
230static inline bool hugetlb_register_node(struct node *node) 227static inline bool hugetlb_register_node(struct node *node)
231{ 228{
232 if (__hugetlb_register_node && 229 if (__hugetlb_register_node &&
233 node_state(node->sysdev.id, N_HIGH_MEMORY)) { 230 node_state(node->dev.id, N_HIGH_MEMORY)) {
234 __hugetlb_register_node(node); 231 __hugetlb_register_node(node);
235 return true; 232 return true;
236 } 233 }
@@ -266,17 +263,17 @@ int register_node(struct node *node, int num, struct node *parent)
266{ 263{
267 int error; 264 int error;
268 265
269 node->sysdev.id = num; 266 node->dev.id = num;
270 node->sysdev.cls = &node_class; 267 node->dev.bus = &node_subsys;
271 error = sysdev_register(&node->sysdev); 268 error = device_register(&node->dev);
272 269
273 if (!error){ 270 if (!error){
274 sysdev_create_file(&node->sysdev, &attr_cpumap); 271 device_create_file(&node->dev, &dev_attr_cpumap);
275 sysdev_create_file(&node->sysdev, &attr_cpulist); 272 device_create_file(&node->dev, &dev_attr_cpulist);
276 sysdev_create_file(&node->sysdev, &attr_meminfo); 273 device_create_file(&node->dev, &dev_attr_meminfo);
277 sysdev_create_file(&node->sysdev, &attr_numastat); 274 device_create_file(&node->dev, &dev_attr_numastat);
278 sysdev_create_file(&node->sysdev, &attr_distance); 275 device_create_file(&node->dev, &dev_attr_distance);
279 sysdev_create_file(&node->sysdev, &attr_vmstat); 276 device_create_file(&node->dev, &dev_attr_vmstat);
280 277
281 scan_unevictable_register_node(node); 278 scan_unevictable_register_node(node);
282 279
@@ -296,17 +293,17 @@ int register_node(struct node *node, int num, struct node *parent)
296 */ 293 */
297void unregister_node(struct node *node) 294void unregister_node(struct node *node)
298{ 295{
299 sysdev_remove_file(&node->sysdev, &attr_cpumap); 296 device_remove_file(&node->dev, &dev_attr_cpumap);
300 sysdev_remove_file(&node->sysdev, &attr_cpulist); 297 device_remove_file(&node->dev, &dev_attr_cpulist);
301 sysdev_remove_file(&node->sysdev, &attr_meminfo); 298 device_remove_file(&node->dev, &dev_attr_meminfo);
302 sysdev_remove_file(&node->sysdev, &attr_numastat); 299 device_remove_file(&node->dev, &dev_attr_numastat);
303 sysdev_remove_file(&node->sysdev, &attr_distance); 300 device_remove_file(&node->dev, &dev_attr_distance);
304 sysdev_remove_file(&node->sysdev, &attr_vmstat); 301 device_remove_file(&node->dev, &dev_attr_vmstat);
305 302
306 scan_unevictable_unregister_node(node); 303 scan_unevictable_unregister_node(node);
307 hugetlb_unregister_node(node); /* no-op, if memoryless node */ 304 hugetlb_unregister_node(node); /* no-op, if memoryless node */
308 305
309 sysdev_unregister(&node->sysdev); 306 device_unregister(&node->dev);
310} 307}
311 308
312struct node node_devices[MAX_NUMNODES]; 309struct node node_devices[MAX_NUMNODES];
@@ -317,41 +314,41 @@ struct node node_devices[MAX_NUMNODES];
317int register_cpu_under_node(unsigned int cpu, unsigned int nid) 314int register_cpu_under_node(unsigned int cpu, unsigned int nid)
318{ 315{
319 int ret; 316 int ret;
320 struct sys_device *obj; 317 struct device *obj;
321 318
322 if (!node_online(nid)) 319 if (!node_online(nid))
323 return 0; 320 return 0;
324 321
325 obj = get_cpu_sysdev(cpu); 322 obj = get_cpu_device(cpu);
326 if (!obj) 323 if (!obj)
327 return 0; 324 return 0;
328 325
329 ret = sysfs_create_link(&node_devices[nid].sysdev.kobj, 326 ret = sysfs_create_link(&node_devices[nid].dev.kobj,
330 &obj->kobj, 327 &obj->kobj,
331 kobject_name(&obj->kobj)); 328 kobject_name(&obj->kobj));
332 if (ret) 329 if (ret)
333 return ret; 330 return ret;
334 331
335 return sysfs_create_link(&obj->kobj, 332 return sysfs_create_link(&obj->kobj,
336 &node_devices[nid].sysdev.kobj, 333 &node_devices[nid].dev.kobj,
337 kobject_name(&node_devices[nid].sysdev.kobj)); 334 kobject_name(&node_devices[nid].dev.kobj));
338} 335}
339 336
340int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) 337int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
341{ 338{
342 struct sys_device *obj; 339 struct device *obj;
343 340
344 if (!node_online(nid)) 341 if (!node_online(nid))
345 return 0; 342 return 0;
346 343
347 obj = get_cpu_sysdev(cpu); 344 obj = get_cpu_device(cpu);
348 if (!obj) 345 if (!obj)
349 return 0; 346 return 0;
350 347
351 sysfs_remove_link(&node_devices[nid].sysdev.kobj, 348 sysfs_remove_link(&node_devices[nid].dev.kobj,
352 kobject_name(&obj->kobj)); 349 kobject_name(&obj->kobj));
353 sysfs_remove_link(&obj->kobj, 350 sysfs_remove_link(&obj->kobj,
354 kobject_name(&node_devices[nid].sysdev.kobj)); 351 kobject_name(&node_devices[nid].dev.kobj));
355 352
356 return 0; 353 return 0;
357} 354}
@@ -393,15 +390,15 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
393 continue; 390 continue;
394 if (page_nid != nid) 391 if (page_nid != nid)
395 continue; 392 continue;
396 ret = sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj, 393 ret = sysfs_create_link_nowarn(&node_devices[nid].dev.kobj,
397 &mem_blk->sysdev.kobj, 394 &mem_blk->dev.kobj,
398 kobject_name(&mem_blk->sysdev.kobj)); 395 kobject_name(&mem_blk->dev.kobj));
399 if (ret) 396 if (ret)
400 return ret; 397 return ret;
401 398
402 return sysfs_create_link_nowarn(&mem_blk->sysdev.kobj, 399 return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
403 &node_devices[nid].sysdev.kobj, 400 &node_devices[nid].dev.kobj,
404 kobject_name(&node_devices[nid].sysdev.kobj)); 401 kobject_name(&node_devices[nid].dev.kobj));
405 } 402 }
406 /* mem section does not span the specified node */ 403 /* mem section does not span the specified node */
407 return 0; 404 return 0;
@@ -434,10 +431,10 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
434 continue; 431 continue;
435 if (node_test_and_set(nid, *unlinked_nodes)) 432 if (node_test_and_set(nid, *unlinked_nodes))
436 continue; 433 continue;
437 sysfs_remove_link(&node_devices[nid].sysdev.kobj, 434 sysfs_remove_link(&node_devices[nid].dev.kobj,
438 kobject_name(&mem_blk->sysdev.kobj)); 435 kobject_name(&mem_blk->dev.kobj));
439 sysfs_remove_link(&mem_blk->sysdev.kobj, 436 sysfs_remove_link(&mem_blk->dev.kobj,
440 kobject_name(&node_devices[nid].sysdev.kobj)); 437 kobject_name(&node_devices[nid].dev.kobj));
441 } 438 }
442 NODEMASK_FREE(unlinked_nodes); 439 NODEMASK_FREE(unlinked_nodes);
443 return 0; 440 return 0;
@@ -468,7 +465,7 @@ static int link_mem_sections(int nid)
468 } 465 }
469 466
470 if (mem_blk) 467 if (mem_blk)
471 kobject_put(&mem_blk->sysdev.kobj); 468 kobject_put(&mem_blk->dev.kobj);
472 return err; 469 return err;
473} 470}
474 471
@@ -596,19 +593,19 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
596} 593}
597 594
598struct node_attr { 595struct node_attr {
599 struct sysdev_class_attribute attr; 596 struct device_attribute attr;
600 enum node_states state; 597 enum node_states state;
601}; 598};
602 599
603static ssize_t show_node_state(struct sysdev_class *class, 600static ssize_t show_node_state(struct device *dev,
604 struct sysdev_class_attribute *attr, char *buf) 601 struct device_attribute *attr, char *buf)
605{ 602{
606 struct node_attr *na = container_of(attr, struct node_attr, attr); 603 struct node_attr *na = container_of(attr, struct node_attr, attr);
607 return print_nodes_state(na->state, buf); 604 return print_nodes_state(na->state, buf);
608} 605}
609 606
610#define _NODE_ATTR(name, state) \ 607#define _NODE_ATTR(name, state) \
611 { _SYSDEV_CLASS_ATTR(name, 0444, show_node_state, NULL), state } 608 { __ATTR(name, 0444, show_node_state, NULL), state }
612 609
613static struct node_attr node_state_attr[] = { 610static struct node_attr node_state_attr[] = {
614 _NODE_ATTR(possible, N_POSSIBLE), 611 _NODE_ATTR(possible, N_POSSIBLE),
@@ -620,17 +617,26 @@ static struct node_attr node_state_attr[] = {
620#endif 617#endif
621}; 618};
622 619
623static struct sysdev_class_attribute *node_state_attrs[] = { 620static struct attribute *node_state_attrs[] = {
624 &node_state_attr[0].attr, 621 &node_state_attr[0].attr.attr,
625 &node_state_attr[1].attr, 622 &node_state_attr[1].attr.attr,
626 &node_state_attr[2].attr, 623 &node_state_attr[2].attr.attr,
627 &node_state_attr[3].attr, 624 &node_state_attr[3].attr.attr,
628#ifdef CONFIG_HIGHMEM 625#ifdef CONFIG_HIGHMEM
629 &node_state_attr[4].attr, 626 &node_state_attr[4].attr.attr,
630#endif 627#endif
631 NULL 628 NULL
632}; 629};
633 630
631static struct attribute_group memory_root_attr_group = {
632 .attrs = node_state_attrs,
633};
634
635static const struct attribute_group *cpu_root_attr_groups[] = {
636 &memory_root_attr_group,
637 NULL,
638};
639
634#define NODE_CALLBACK_PRI 2 /* lower than SLAB */ 640#define NODE_CALLBACK_PRI 2 /* lower than SLAB */
635static int __init register_node_type(void) 641static int __init register_node_type(void)
636{ 642{
@@ -639,7 +645,7 @@ static int __init register_node_type(void)
639 BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES); 645 BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES);
640 BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES); 646 BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES);
641 647
642 ret = sysdev_class_register(&node_class); 648 ret = subsys_system_register(&node_subsys, cpu_root_attr_groups);
643 if (!ret) { 649 if (!ret) {
644 hotplug_memory_notifier(node_memory_callback, 650 hotplug_memory_notifier(node_memory_callback,
645 NODE_CALLBACK_PRI); 651 NODE_CALLBACK_PRI);
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 7a24895543e7..a7c06374062e 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -383,7 +383,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregister);
383 * Returns &struct platform_device pointer on success, or ERR_PTR() on error. 383 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
384 */ 384 */
385struct platform_device *platform_device_register_full( 385struct platform_device *platform_device_register_full(
386 struct platform_device_info *pdevinfo) 386 const struct platform_device_info *pdevinfo)
387{ 387{
388 int ret = -ENOMEM; 388 int ret = -ENOMEM;
389 struct platform_device *pdev; 389 struct platform_device *pdev;
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 9dff77bfe1e3..409f5ce78829 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -126,7 +126,7 @@ void sysdev_class_remove_file(struct sysdev_class *c,
126} 126}
127EXPORT_SYMBOL_GPL(sysdev_class_remove_file); 127EXPORT_SYMBOL_GPL(sysdev_class_remove_file);
128 128
129static struct kset *system_kset; 129extern struct kset *system_kset;
130 130
131int sysdev_class_register(struct sysdev_class *cls) 131int sysdev_class_register(struct sysdev_class *cls)
132{ 132{
@@ -331,14 +331,6 @@ void sysdev_unregister(struct sys_device *sysdev)
331EXPORT_SYMBOL_GPL(sysdev_register); 331EXPORT_SYMBOL_GPL(sysdev_register);
332EXPORT_SYMBOL_GPL(sysdev_unregister); 332EXPORT_SYMBOL_GPL(sysdev_unregister);
333 333
334int __init system_bus_init(void)
335{
336 system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj);
337 if (!system_kset)
338 return -ENOMEM;
339 return 0;
340}
341
342#define to_ext_attr(x) container_of(x, struct sysdev_ext_attribute, attr) 334#define to_ext_attr(x) container_of(x, struct sysdev_ext_attribute, attr)
343 335
344ssize_t sysdev_store_ulong(struct sys_device *sysdev, 336ssize_t sysdev_store_ulong(struct sys_device *sysdev,
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index f6f37a05a0c3..ae989c57cd5e 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -23,7 +23,6 @@
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * 24 *
25 */ 25 */
26#include <linux/sysdev.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/cpu.h> 28#include <linux/cpu.h>
@@ -32,14 +31,14 @@
32#include <linux/topology.h> 31#include <linux/topology.h>
33 32
34#define define_one_ro_named(_name, _func) \ 33#define define_one_ro_named(_name, _func) \
35static SYSDEV_ATTR(_name, 0444, _func, NULL) 34 static DEVICE_ATTR(_name, 0444, _func, NULL)
36 35
37#define define_one_ro(_name) \ 36#define define_one_ro(_name) \
38static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) 37 static DEVICE_ATTR(_name, 0444, show_##_name, NULL)
39 38
40#define define_id_show_func(name) \ 39#define define_id_show_func(name) \
41static ssize_t show_##name(struct sys_device *dev, \ 40static ssize_t show_##name(struct device *dev, \
42 struct sysdev_attribute *attr, char *buf) \ 41 struct device_attribute *attr, char *buf) \
43{ \ 42{ \
44 unsigned int cpu = dev->id; \ 43 unsigned int cpu = dev->id; \
45 return sprintf(buf, "%d\n", topology_##name(cpu)); \ 44 return sprintf(buf, "%d\n", topology_##name(cpu)); \
@@ -65,16 +64,16 @@ static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf)
65 64
66#ifdef arch_provides_topology_pointers 65#ifdef arch_provides_topology_pointers
67#define define_siblings_show_map(name) \ 66#define define_siblings_show_map(name) \
68static ssize_t show_##name(struct sys_device *dev, \ 67static ssize_t show_##name(struct device *dev, \
69 struct sysdev_attribute *attr, char *buf) \ 68 struct device_attribute *attr, char *buf) \
70{ \ 69{ \
71 unsigned int cpu = dev->id; \ 70 unsigned int cpu = dev->id; \
72 return show_cpumap(0, topology_##name(cpu), buf); \ 71 return show_cpumap(0, topology_##name(cpu), buf); \
73} 72}
74 73
75#define define_siblings_show_list(name) \ 74#define define_siblings_show_list(name) \
76static ssize_t show_##name##_list(struct sys_device *dev, \ 75static ssize_t show_##name##_list(struct device *dev, \
77 struct sysdev_attribute *attr, \ 76 struct device_attribute *attr, \
78 char *buf) \ 77 char *buf) \
79{ \ 78{ \
80 unsigned int cpu = dev->id; \ 79 unsigned int cpu = dev->id; \
@@ -83,15 +82,15 @@ static ssize_t show_##name##_list(struct sys_device *dev, \
83 82
84#else 83#else
85#define define_siblings_show_map(name) \ 84#define define_siblings_show_map(name) \
86static ssize_t show_##name(struct sys_device *dev, \ 85static ssize_t show_##name(struct device *dev, \
87 struct sysdev_attribute *attr, char *buf) \ 86 struct device_attribute *attr, char *buf) \
88{ \ 87{ \
89 return show_cpumap(0, topology_##name(dev->id), buf); \ 88 return show_cpumap(0, topology_##name(dev->id), buf); \
90} 89}
91 90
92#define define_siblings_show_list(name) \ 91#define define_siblings_show_list(name) \
93static ssize_t show_##name##_list(struct sys_device *dev, \ 92static ssize_t show_##name##_list(struct device *dev, \
94 struct sysdev_attribute *attr, \ 93 struct device_attribute *attr, \
95 char *buf) \ 94 char *buf) \
96{ \ 95{ \
97 return show_cpumap(1, topology_##name(dev->id), buf); \ 96 return show_cpumap(1, topology_##name(dev->id), buf); \
@@ -124,16 +123,16 @@ define_one_ro_named(book_siblings_list, show_book_cpumask_list);
124#endif 123#endif
125 124
126static struct attribute *default_attrs[] = { 125static struct attribute *default_attrs[] = {
127 &attr_physical_package_id.attr, 126 &dev_attr_physical_package_id.attr,
128 &attr_core_id.attr, 127 &dev_attr_core_id.attr,
129 &attr_thread_siblings.attr, 128 &dev_attr_thread_siblings.attr,
130 &attr_thread_siblings_list.attr, 129 &dev_attr_thread_siblings_list.attr,
131 &attr_core_siblings.attr, 130 &dev_attr_core_siblings.attr,
132 &attr_core_siblings_list.attr, 131 &dev_attr_core_siblings_list.attr,
133#ifdef CONFIG_SCHED_BOOK 132#ifdef CONFIG_SCHED_BOOK
134 &attr_book_id.attr, 133 &dev_attr_book_id.attr,
135 &attr_book_siblings.attr, 134 &dev_attr_book_siblings.attr,
136 &attr_book_siblings_list.attr, 135 &dev_attr_book_siblings_list.attr,
137#endif 136#endif
138 NULL 137 NULL
139}; 138};
@@ -146,16 +145,16 @@ static struct attribute_group topology_attr_group = {
146/* Add/Remove cpu_topology interface for CPU device */ 145/* Add/Remove cpu_topology interface for CPU device */
147static int __cpuinit topology_add_dev(unsigned int cpu) 146static int __cpuinit topology_add_dev(unsigned int cpu)
148{ 147{
149 struct sys_device *sys_dev = get_cpu_sysdev(cpu); 148 struct device *dev = get_cpu_device(cpu);
150 149
151 return sysfs_create_group(&sys_dev->kobj, &topology_attr_group); 150 return sysfs_create_group(&dev->kobj, &topology_attr_group);
152} 151}
153 152
154static void __cpuinit topology_remove_dev(unsigned int cpu) 153static void __cpuinit topology_remove_dev(unsigned int cpu)
155{ 154{
156 struct sys_device *sys_dev = get_cpu_sysdev(cpu); 155 struct device *dev = get_cpu_device(cpu);
157 156
158 sysfs_remove_group(&sys_dev->kobj, &topology_attr_group); 157 sysfs_remove_group(&dev->kobj, &topology_attr_group);
159} 158}
160 159
161static int __cpuinit topology_cpu_callback(struct notifier_block *nfb, 160static int __cpuinit topology_cpu_callback(struct notifier_block *nfb,
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 106beb194f3c..cf77a9a2bfa4 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -423,19 +423,7 @@ static struct usb_driver ath3k_driver = {
423 .id_table = ath3k_table, 423 .id_table = ath3k_table,
424}; 424};
425 425
426static int __init ath3k_init(void) 426module_usb_driver(ath3k_driver);
427{
428 BT_INFO("Atheros AR30xx firmware driver ver %s", VERSION);
429 return usb_register(&ath3k_driver);
430}
431
432static void __exit ath3k_exit(void)
433{
434 usb_deregister(&ath3k_driver);
435}
436
437module_init(ath3k_init);
438module_exit(ath3k_exit);
439 427
440MODULE_AUTHOR("Atheros Communications"); 428MODULE_AUTHOR("Atheros Communications");
441MODULE_DESCRIPTION("Atheros AR30xx firmware driver"); 429MODULE_DESCRIPTION("Atheros AR30xx firmware driver");
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c
index 54952ab800b8..1e742a50e2cd 100644
--- a/drivers/bluetooth/bcm203x.c
+++ b/drivers/bluetooth/bcm203x.c
@@ -281,26 +281,7 @@ static struct usb_driver bcm203x_driver = {
281 .id_table = bcm203x_table, 281 .id_table = bcm203x_table,
282}; 282};
283 283
284static int __init bcm203x_init(void) 284module_usb_driver(bcm203x_driver);
285{
286 int err;
287
288 BT_INFO("Broadcom Blutonium firmware driver ver %s", VERSION);
289
290 err = usb_register(&bcm203x_driver);
291 if (err < 0)
292 BT_ERR("Failed to register USB driver");
293
294 return err;
295}
296
297static void __exit bcm203x_exit(void)
298{
299 usb_deregister(&bcm203x_driver);
300}
301
302module_init(bcm203x_init);
303module_exit(bcm203x_exit);
304 285
305MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); 286MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
306MODULE_DESCRIPTION("Broadcom Blutonium firmware driver ver " VERSION); 287MODULE_DESCRIPTION("Broadcom Blutonium firmware driver ver " VERSION);
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 61b591470a90..e64a290a1b98 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -764,26 +764,7 @@ static struct usb_driver bfusb_driver = {
764 .id_table = bfusb_table, 764 .id_table = bfusb_table,
765}; 765};
766 766
767static int __init bfusb_init(void) 767module_usb_driver(bfusb_driver);
768{
769 int err;
770
771 BT_INFO("BlueFRITZ! USB driver ver %s", VERSION);
772
773 err = usb_register(&bfusb_driver);
774 if (err < 0)
775 BT_ERR("Failed to register BlueFRITZ! USB driver");
776
777 return err;
778}
779
780static void __exit bfusb_exit(void)
781{
782 usb_deregister(&bfusb_driver);
783}
784
785module_init(bfusb_init);
786module_exit(bfusb_exit);
787 768
788MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); 769MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
789MODULE_DESCRIPTION("BlueFRITZ! USB driver ver " VERSION); 770MODULE_DESCRIPTION("BlueFRITZ! USB driver ver " VERSION);
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 751b338d904a..62831603de5e 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -521,20 +521,7 @@ static struct usb_driver bpa10x_driver = {
521 .id_table = bpa10x_table, 521 .id_table = bpa10x_table,
522}; 522};
523 523
524static int __init bpa10x_init(void) 524module_usb_driver(bpa10x_driver);
525{
526 BT_INFO("Digianswer Bluetooth USB driver ver %s", VERSION);
527
528 return usb_register(&bpa10x_driver);
529}
530
531static void __exit bpa10x_exit(void)
532{
533 usb_deregister(&bpa10x_driver);
534}
535
536module_init(bpa10x_init);
537module_exit(bpa10x_exit);
538 525
539MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); 526MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
540MODULE_DESCRIPTION("Digianswer Bluetooth USB driver ver " VERSION); 527MODULE_DESCRIPTION("Digianswer Bluetooth USB driver ver " VERSION);
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index eabc437ce500..0c3e179b7589 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1222,20 +1222,7 @@ static struct usb_driver btusb_driver = {
1222 .supports_autosuspend = 1, 1222 .supports_autosuspend = 1,
1223}; 1223};
1224 1224
1225static int __init btusb_init(void) 1225module_usb_driver(btusb_driver);
1226{
1227 BT_INFO("Generic Bluetooth USB driver ver %s", VERSION);
1228
1229 return usb_register(&btusb_driver);
1230}
1231
1232static void __exit btusb_exit(void)
1233{
1234 usb_deregister(&btusb_driver);
1235}
1236
1237module_init(btusb_init);
1238module_exit(btusb_exit);
1239 1226
1240module_param(ignore_dga, bool, 0644); 1227module_param(ignore_dga, bool, 0644);
1241MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001"); 1228MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001");
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 987a165ede26..8c2df3499da7 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -679,7 +679,7 @@ static struct kobj_type ktype_cpufreq = {
679 */ 679 */
680static int cpufreq_add_dev_policy(unsigned int cpu, 680static int cpufreq_add_dev_policy(unsigned int cpu,
681 struct cpufreq_policy *policy, 681 struct cpufreq_policy *policy,
682 struct sys_device *sys_dev) 682 struct device *dev)
683{ 683{
684 int ret = 0; 684 int ret = 0;
685#ifdef CONFIG_SMP 685#ifdef CONFIG_SMP
@@ -728,7 +728,7 @@ static int cpufreq_add_dev_policy(unsigned int cpu,
728 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 728 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
729 729
730 pr_debug("CPU already managed, adding link\n"); 730 pr_debug("CPU already managed, adding link\n");
731 ret = sysfs_create_link(&sys_dev->kobj, 731 ret = sysfs_create_link(&dev->kobj,
732 &managed_policy->kobj, 732 &managed_policy->kobj,
733 "cpufreq"); 733 "cpufreq");
734 if (ret) 734 if (ret)
@@ -761,7 +761,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
761 761
762 for_each_cpu(j, policy->cpus) { 762 for_each_cpu(j, policy->cpus) {
763 struct cpufreq_policy *managed_policy; 763 struct cpufreq_policy *managed_policy;
764 struct sys_device *cpu_sys_dev; 764 struct device *cpu_dev;
765 765
766 if (j == cpu) 766 if (j == cpu)
767 continue; 767 continue;
@@ -770,8 +770,8 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
770 770
771 pr_debug("CPU %u already managed, adding link\n", j); 771 pr_debug("CPU %u already managed, adding link\n", j);
772 managed_policy = cpufreq_cpu_get(cpu); 772 managed_policy = cpufreq_cpu_get(cpu);
773 cpu_sys_dev = get_cpu_sysdev(j); 773 cpu_dev = get_cpu_device(j);
774 ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, 774 ret = sysfs_create_link(&cpu_dev->kobj, &policy->kobj,
775 "cpufreq"); 775 "cpufreq");
776 if (ret) { 776 if (ret) {
777 cpufreq_cpu_put(managed_policy); 777 cpufreq_cpu_put(managed_policy);
@@ -783,7 +783,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
783 783
784static int cpufreq_add_dev_interface(unsigned int cpu, 784static int cpufreq_add_dev_interface(unsigned int cpu,
785 struct cpufreq_policy *policy, 785 struct cpufreq_policy *policy,
786 struct sys_device *sys_dev) 786 struct device *dev)
787{ 787{
788 struct cpufreq_policy new_policy; 788 struct cpufreq_policy new_policy;
789 struct freq_attr **drv_attr; 789 struct freq_attr **drv_attr;
@@ -793,7 +793,7 @@ static int cpufreq_add_dev_interface(unsigned int cpu,
793 793
794 /* prepare interface data */ 794 /* prepare interface data */
795 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, 795 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
796 &sys_dev->kobj, "cpufreq"); 796 &dev->kobj, "cpufreq");
797 if (ret) 797 if (ret)
798 return ret; 798 return ret;
799 799
@@ -866,9 +866,9 @@ err_out_kobj_put:
866 * with with cpu hotplugging and all hell will break loose. Tried to clean this 866 * with with cpu hotplugging and all hell will break loose. Tried to clean this
867 * mess up, but more thorough testing is needed. - Mathieu 867 * mess up, but more thorough testing is needed. - Mathieu
868 */ 868 */
869static int cpufreq_add_dev(struct sys_device *sys_dev) 869static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
870{ 870{
871 unsigned int cpu = sys_dev->id; 871 unsigned int cpu = dev->id;
872 int ret = 0, found = 0; 872 int ret = 0, found = 0;
873 struct cpufreq_policy *policy; 873 struct cpufreq_policy *policy;
874 unsigned long flags; 874 unsigned long flags;
@@ -947,7 +947,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
947 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 947 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
948 CPUFREQ_START, policy); 948 CPUFREQ_START, policy);
949 949
950 ret = cpufreq_add_dev_policy(cpu, policy, sys_dev); 950 ret = cpufreq_add_dev_policy(cpu, policy, dev);
951 if (ret) { 951 if (ret) {
952 if (ret > 0) 952 if (ret > 0)
953 /* This is a managed cpu, symlink created, 953 /* This is a managed cpu, symlink created,
@@ -956,7 +956,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
956 goto err_unlock_policy; 956 goto err_unlock_policy;
957 } 957 }
958 958
959 ret = cpufreq_add_dev_interface(cpu, policy, sys_dev); 959 ret = cpufreq_add_dev_interface(cpu, policy, dev);
960 if (ret) 960 if (ret)
961 goto err_out_unregister; 961 goto err_out_unregister;
962 962
@@ -999,15 +999,15 @@ module_out:
999 * Caller should already have policy_rwsem in write mode for this CPU. 999 * Caller should already have policy_rwsem in write mode for this CPU.
1000 * This routine frees the rwsem before returning. 1000 * This routine frees the rwsem before returning.
1001 */ 1001 */
1002static int __cpufreq_remove_dev(struct sys_device *sys_dev) 1002static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
1003{ 1003{
1004 unsigned int cpu = sys_dev->id; 1004 unsigned int cpu = dev->id;
1005 unsigned long flags; 1005 unsigned long flags;
1006 struct cpufreq_policy *data; 1006 struct cpufreq_policy *data;
1007 struct kobject *kobj; 1007 struct kobject *kobj;
1008 struct completion *cmp; 1008 struct completion *cmp;
1009#ifdef CONFIG_SMP 1009#ifdef CONFIG_SMP
1010 struct sys_device *cpu_sys_dev; 1010 struct device *cpu_dev;
1011 unsigned int j; 1011 unsigned int j;
1012#endif 1012#endif
1013 1013
@@ -1032,7 +1032,7 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1032 pr_debug("removing link\n"); 1032 pr_debug("removing link\n");
1033 cpumask_clear_cpu(cpu, data->cpus); 1033 cpumask_clear_cpu(cpu, data->cpus);
1034 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1034 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1035 kobj = &sys_dev->kobj; 1035 kobj = &dev->kobj;
1036 cpufreq_cpu_put(data); 1036 cpufreq_cpu_put(data);
1037 unlock_policy_rwsem_write(cpu); 1037 unlock_policy_rwsem_write(cpu);
1038 sysfs_remove_link(kobj, "cpufreq"); 1038 sysfs_remove_link(kobj, "cpufreq");
@@ -1071,8 +1071,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1071 strncpy(per_cpu(cpufreq_cpu_governor, j), 1071 strncpy(per_cpu(cpufreq_cpu_governor, j),
1072 data->governor->name, CPUFREQ_NAME_LEN); 1072 data->governor->name, CPUFREQ_NAME_LEN);
1073#endif 1073#endif
1074 cpu_sys_dev = get_cpu_sysdev(j); 1074 cpu_dev = get_cpu_device(j);
1075 kobj = &cpu_sys_dev->kobj; 1075 kobj = &cpu_dev->kobj;
1076 unlock_policy_rwsem_write(cpu); 1076 unlock_policy_rwsem_write(cpu);
1077 sysfs_remove_link(kobj, "cpufreq"); 1077 sysfs_remove_link(kobj, "cpufreq");
1078 lock_policy_rwsem_write(cpu); 1078 lock_policy_rwsem_write(cpu);
@@ -1112,11 +1112,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1112 if (unlikely(cpumask_weight(data->cpus) > 1)) { 1112 if (unlikely(cpumask_weight(data->cpus) > 1)) {
1113 /* first sibling now owns the new sysfs dir */ 1113 /* first sibling now owns the new sysfs dir */
1114 cpumask_clear_cpu(cpu, data->cpus); 1114 cpumask_clear_cpu(cpu, data->cpus);
1115 cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus))); 1115 cpufreq_add_dev(get_cpu_device(cpumask_first(data->cpus)), NULL);
1116 1116
1117 /* finally remove our own symlink */ 1117 /* finally remove our own symlink */
1118 lock_policy_rwsem_write(cpu); 1118 lock_policy_rwsem_write(cpu);
1119 __cpufreq_remove_dev(sys_dev); 1119 __cpufreq_remove_dev(dev, sif);
1120 } 1120 }
1121#endif 1121#endif
1122 1122
@@ -1128,9 +1128,9 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1128} 1128}
1129 1129
1130 1130
1131static int cpufreq_remove_dev(struct sys_device *sys_dev) 1131static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
1132{ 1132{
1133 unsigned int cpu = sys_dev->id; 1133 unsigned int cpu = dev->id;
1134 int retval; 1134 int retval;
1135 1135
1136 if (cpu_is_offline(cpu)) 1136 if (cpu_is_offline(cpu))
@@ -1139,7 +1139,7 @@ static int cpufreq_remove_dev(struct sys_device *sys_dev)
1139 if (unlikely(lock_policy_rwsem_write(cpu))) 1139 if (unlikely(lock_policy_rwsem_write(cpu)))
1140 BUG(); 1140 BUG();
1141 1141
1142 retval = __cpufreq_remove_dev(sys_dev); 1142 retval = __cpufreq_remove_dev(dev, sif);
1143 return retval; 1143 return retval;
1144} 1144}
1145 1145
@@ -1271,9 +1271,11 @@ out:
1271} 1271}
1272EXPORT_SYMBOL(cpufreq_get); 1272EXPORT_SYMBOL(cpufreq_get);
1273 1273
1274static struct sysdev_driver cpufreq_sysdev_driver = { 1274static struct subsys_interface cpufreq_interface = {
1275 .add = cpufreq_add_dev, 1275 .name = "cpufreq",
1276 .remove = cpufreq_remove_dev, 1276 .subsys = &cpu_subsys,
1277 .add_dev = cpufreq_add_dev,
1278 .remove_dev = cpufreq_remove_dev,
1277}; 1279};
1278 1280
1279 1281
@@ -1765,25 +1767,25 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
1765 unsigned long action, void *hcpu) 1767 unsigned long action, void *hcpu)
1766{ 1768{
1767 unsigned int cpu = (unsigned long)hcpu; 1769 unsigned int cpu = (unsigned long)hcpu;
1768 struct sys_device *sys_dev; 1770 struct device *dev;
1769 1771
1770 sys_dev = get_cpu_sysdev(cpu); 1772 dev = get_cpu_device(cpu);
1771 if (sys_dev) { 1773 if (dev) {
1772 switch (action) { 1774 switch (action) {
1773 case CPU_ONLINE: 1775 case CPU_ONLINE:
1774 case CPU_ONLINE_FROZEN: 1776 case CPU_ONLINE_FROZEN:
1775 cpufreq_add_dev(sys_dev); 1777 cpufreq_add_dev(dev, NULL);
1776 break; 1778 break;
1777 case CPU_DOWN_PREPARE: 1779 case CPU_DOWN_PREPARE:
1778 case CPU_DOWN_PREPARE_FROZEN: 1780 case CPU_DOWN_PREPARE_FROZEN:
1779 if (unlikely(lock_policy_rwsem_write(cpu))) 1781 if (unlikely(lock_policy_rwsem_write(cpu)))
1780 BUG(); 1782 BUG();
1781 1783
1782 __cpufreq_remove_dev(sys_dev); 1784 __cpufreq_remove_dev(dev, NULL);
1783 break; 1785 break;
1784 case CPU_DOWN_FAILED: 1786 case CPU_DOWN_FAILED:
1785 case CPU_DOWN_FAILED_FROZEN: 1787 case CPU_DOWN_FAILED_FROZEN:
1786 cpufreq_add_dev(sys_dev); 1788 cpufreq_add_dev(dev, NULL);
1787 break; 1789 break;
1788 } 1790 }
1789 } 1791 }
@@ -1830,8 +1832,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
1830 cpufreq_driver = driver_data; 1832 cpufreq_driver = driver_data;
1831 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1833 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1832 1834
1833 ret = sysdev_driver_register(&cpu_sysdev_class, 1835 ret = subsys_interface_register(&cpufreq_interface);
1834 &cpufreq_sysdev_driver);
1835 if (ret) 1836 if (ret)
1836 goto err_null_driver; 1837 goto err_null_driver;
1837 1838
@@ -1850,7 +1851,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
1850 if (ret) { 1851 if (ret) {
1851 pr_debug("no CPU initialized for driver %s\n", 1852 pr_debug("no CPU initialized for driver %s\n",
1852 driver_data->name); 1853 driver_data->name);
1853 goto err_sysdev_unreg; 1854 goto err_if_unreg;
1854 } 1855 }
1855 } 1856 }
1856 1857
@@ -1858,9 +1859,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
1858 pr_debug("driver %s up and running\n", driver_data->name); 1859 pr_debug("driver %s up and running\n", driver_data->name);
1859 1860
1860 return 0; 1861 return 0;
1861err_sysdev_unreg: 1862err_if_unreg:
1862 sysdev_driver_unregister(&cpu_sysdev_class, 1863 subsys_interface_unregister(&cpufreq_interface);
1863 &cpufreq_sysdev_driver);
1864err_null_driver: 1864err_null_driver:
1865 spin_lock_irqsave(&cpufreq_driver_lock, flags); 1865 spin_lock_irqsave(&cpufreq_driver_lock, flags);
1866 cpufreq_driver = NULL; 1866 cpufreq_driver = NULL;
@@ -1887,7 +1887,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
1887 1887
1888 pr_debug("unregistering driver %s\n", driver->name); 1888 pr_debug("unregistering driver %s\n", driver->name);
1889 1889
1890 sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); 1890 subsys_interface_unregister(&cpufreq_interface);
1891 unregister_hotcpu_notifier(&cpufreq_cpu_notifier); 1891 unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
1892 1892
1893 spin_lock_irqsave(&cpufreq_driver_lock, flags); 1893 spin_lock_irqsave(&cpufreq_driver_lock, flags);
@@ -1907,8 +1907,7 @@ static int __init cpufreq_core_init(void)
1907 init_rwsem(&per_cpu(cpu_policy_rwsem, cpu)); 1907 init_rwsem(&per_cpu(cpu_policy_rwsem, cpu));
1908 } 1908 }
1909 1909
1910 cpufreq_global_kobject = kobject_create_and_add("cpufreq", 1910 cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj);
1911 &cpu_sysdev_class.kset.kobj);
1912 BUG_ON(!cpufreq_global_kobject); 1911 BUG_ON(!cpufreq_global_kobject);
1913 register_syscore_ops(&cpufreq_syscore_ops); 1912 register_syscore_ops(&cpufreq_syscore_ops);
1914 1913
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index c5072a91e848..390380a8cfc9 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/sysdev.h>
15#include <linux/cpu.h> 14#include <linux/cpu.h>
16#include <linux/sysfs.h> 15#include <linux/sysfs.h>
17#include <linux/cpufreq.h> 16#include <linux/cpufreq.h>
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 06ce2680d00d..59f4261c753a 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -291,10 +291,10 @@ EXPORT_SYMBOL_GPL(cpuidle_disable_device);
291static int __cpuidle_register_device(struct cpuidle_device *dev) 291static int __cpuidle_register_device(struct cpuidle_device *dev)
292{ 292{
293 int ret; 293 int ret;
294 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); 294 struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
295 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); 295 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
296 296
297 if (!sys_dev) 297 if (!dev)
298 return -EINVAL; 298 return -EINVAL;
299 if (!try_module_get(cpuidle_driver->owner)) 299 if (!try_module_get(cpuidle_driver->owner))
300 return -EINVAL; 300 return -EINVAL;
@@ -303,7 +303,7 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
303 303
304 per_cpu(cpuidle_devices, dev->cpu) = dev; 304 per_cpu(cpuidle_devices, dev->cpu) = dev;
305 list_add(&dev->device_list, &cpuidle_detected_devices); 305 list_add(&dev->device_list, &cpuidle_detected_devices);
306 if ((ret = cpuidle_add_sysfs(sys_dev))) { 306 if ((ret = cpuidle_add_sysfs(cpu_dev))) {
307 module_put(cpuidle_driver->owner); 307 module_put(cpuidle_driver->owner);
308 return ret; 308 return ret;
309 } 309 }
@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(cpuidle_register_device);
344 */ 344 */
345void cpuidle_unregister_device(struct cpuidle_device *dev) 345void cpuidle_unregister_device(struct cpuidle_device *dev)
346{ 346{
347 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); 347 struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
348 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); 348 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
349 349
350 if (dev->registered == 0) 350 if (dev->registered == 0)
@@ -354,7 +354,7 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)
354 354
355 cpuidle_disable_device(dev); 355 cpuidle_disable_device(dev);
356 356
357 cpuidle_remove_sysfs(sys_dev); 357 cpuidle_remove_sysfs(cpu_dev);
358 list_del(&dev->device_list); 358 list_del(&dev->device_list);
359 wait_for_completion(&dev->kobj_unregister); 359 wait_for_completion(&dev->kobj_unregister);
360 per_cpu(cpuidle_devices, dev->cpu) = NULL; 360 per_cpu(cpuidle_devices, dev->cpu) = NULL;
@@ -411,7 +411,7 @@ static int __init cpuidle_init(void)
411 if (cpuidle_disabled()) 411 if (cpuidle_disabled())
412 return -ENODEV; 412 return -ENODEV;
413 413
414 ret = cpuidle_add_class_sysfs(&cpu_sysdev_class); 414 ret = cpuidle_add_interface(cpu_subsys.dev_root);
415 if (ret) 415 if (ret)
416 return ret; 416 return ret;
417 417
diff --git a/drivers/cpuidle/cpuidle.h b/drivers/cpuidle/cpuidle.h
index 38c3fd8b9d76..7db186685c27 100644
--- a/drivers/cpuidle/cpuidle.h
+++ b/drivers/cpuidle/cpuidle.h
@@ -5,7 +5,7 @@
5#ifndef __DRIVER_CPUIDLE_H 5#ifndef __DRIVER_CPUIDLE_H
6#define __DRIVER_CPUIDLE_H 6#define __DRIVER_CPUIDLE_H
7 7
8#include <linux/sysdev.h> 8#include <linux/device.h>
9 9
10/* For internal use only */ 10/* For internal use only */
11extern struct cpuidle_governor *cpuidle_curr_governor; 11extern struct cpuidle_governor *cpuidle_curr_governor;
@@ -23,11 +23,11 @@ extern void cpuidle_uninstall_idle_handler(void);
23extern int cpuidle_switch_governor(struct cpuidle_governor *gov); 23extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
24 24
25/* sysfs */ 25/* sysfs */
26extern int cpuidle_add_class_sysfs(struct sysdev_class *cls); 26extern int cpuidle_add_interface(struct device *dev);
27extern void cpuidle_remove_class_sysfs(struct sysdev_class *cls); 27extern void cpuidle_remove_interface(struct device *dev);
28extern int cpuidle_add_state_sysfs(struct cpuidle_device *device); 28extern int cpuidle_add_state_sysfs(struct cpuidle_device *device);
29extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device); 29extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device);
30extern int cpuidle_add_sysfs(struct sys_device *sysdev); 30extern int cpuidle_add_sysfs(struct device *dev);
31extern void cpuidle_remove_sysfs(struct sys_device *sysdev); 31extern void cpuidle_remove_sysfs(struct device *dev);
32 32
33#endif /* __DRIVER_CPUIDLE_H */ 33#endif /* __DRIVER_CPUIDLE_H */
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 1e756e160dca..3fe41fe4851a 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -22,8 +22,8 @@ static int __init cpuidle_sysfs_setup(char *unused)
22} 22}
23__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); 23__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup);
24 24
25static ssize_t show_available_governors(struct sysdev_class *class, 25static ssize_t show_available_governors(struct device *dev,
26 struct sysdev_class_attribute *attr, 26 struct device_attribute *attr,
27 char *buf) 27 char *buf)
28{ 28{
29 ssize_t i = 0; 29 ssize_t i = 0;
@@ -42,8 +42,8 @@ out:
42 return i; 42 return i;
43} 43}
44 44
45static ssize_t show_current_driver(struct sysdev_class *class, 45static ssize_t show_current_driver(struct device *dev,
46 struct sysdev_class_attribute *attr, 46 struct device_attribute *attr,
47 char *buf) 47 char *buf)
48{ 48{
49 ssize_t ret; 49 ssize_t ret;
@@ -59,8 +59,8 @@ static ssize_t show_current_driver(struct sysdev_class *class,
59 return ret; 59 return ret;
60} 60}
61 61
62static ssize_t show_current_governor(struct sysdev_class *class, 62static ssize_t show_current_governor(struct device *dev,
63 struct sysdev_class_attribute *attr, 63 struct device_attribute *attr,
64 char *buf) 64 char *buf)
65{ 65{
66 ssize_t ret; 66 ssize_t ret;
@@ -75,8 +75,8 @@ static ssize_t show_current_governor(struct sysdev_class *class,
75 return ret; 75 return ret;
76} 76}
77 77
78static ssize_t store_current_governor(struct sysdev_class *class, 78static ssize_t store_current_governor(struct device *dev,
79 struct sysdev_class_attribute *attr, 79 struct device_attribute *attr,
80 const char *buf, size_t count) 80 const char *buf, size_t count)
81{ 81{
82 char gov_name[CPUIDLE_NAME_LEN]; 82 char gov_name[CPUIDLE_NAME_LEN];
@@ -109,50 +109,48 @@ static ssize_t store_current_governor(struct sysdev_class *class,
109 return count; 109 return count;
110} 110}
111 111
112static SYSDEV_CLASS_ATTR(current_driver, 0444, show_current_driver, NULL); 112static DEVICE_ATTR(current_driver, 0444, show_current_driver, NULL);
113static SYSDEV_CLASS_ATTR(current_governor_ro, 0444, show_current_governor, 113static DEVICE_ATTR(current_governor_ro, 0444, show_current_governor, NULL);
114 NULL);
115 114
116static struct attribute *cpuclass_default_attrs[] = { 115static struct attribute *cpuidle_default_attrs[] = {
117 &attr_current_driver.attr, 116 &dev_attr_current_driver.attr,
118 &attr_current_governor_ro.attr, 117 &dev_attr_current_governor_ro.attr,
119 NULL 118 NULL
120}; 119};
121 120
122static SYSDEV_CLASS_ATTR(available_governors, 0444, show_available_governors, 121static DEVICE_ATTR(available_governors, 0444, show_available_governors, NULL);
123 NULL); 122static DEVICE_ATTR(current_governor, 0644, show_current_governor,
124static SYSDEV_CLASS_ATTR(current_governor, 0644, show_current_governor, 123 store_current_governor);
125 store_current_governor);
126 124
127static struct attribute *cpuclass_switch_attrs[] = { 125static struct attribute *cpuidle_switch_attrs[] = {
128 &attr_available_governors.attr, 126 &dev_attr_available_governors.attr,
129 &attr_current_driver.attr, 127 &dev_attr_current_driver.attr,
130 &attr_current_governor.attr, 128 &dev_attr_current_governor.attr,
131 NULL 129 NULL
132}; 130};
133 131
134static struct attribute_group cpuclass_attr_group = { 132static struct attribute_group cpuidle_attr_group = {
135 .attrs = cpuclass_default_attrs, 133 .attrs = cpuidle_default_attrs,
136 .name = "cpuidle", 134 .name = "cpuidle",
137}; 135};
138 136
139/** 137/**
140 * cpuidle_add_class_sysfs - add CPU global sysfs attributes 138 * cpuidle_add_interface - add CPU global sysfs attributes
141 */ 139 */
142int cpuidle_add_class_sysfs(struct sysdev_class *cls) 140int cpuidle_add_interface(struct device *dev)
143{ 141{
144 if (sysfs_switch) 142 if (sysfs_switch)
145 cpuclass_attr_group.attrs = cpuclass_switch_attrs; 143 cpuidle_attr_group.attrs = cpuidle_switch_attrs;
146 144
147 return sysfs_create_group(&cls->kset.kobj, &cpuclass_attr_group); 145 return sysfs_create_group(&dev->kobj, &cpuidle_attr_group);
148} 146}
149 147
150/** 148/**
151 * cpuidle_remove_class_sysfs - remove CPU global sysfs attributes 149 * cpuidle_remove_interface - remove CPU global sysfs attributes
152 */ 150 */
153void cpuidle_remove_class_sysfs(struct sysdev_class *cls) 151void cpuidle_remove_interface(struct device *dev)
154{ 152{
155 sysfs_remove_group(&cls->kset.kobj, &cpuclass_attr_group); 153 sysfs_remove_group(&dev->kobj, &cpuidle_attr_group);
156} 154}
157 155
158struct cpuidle_attr { 156struct cpuidle_attr {
@@ -365,16 +363,16 @@ void cpuidle_remove_state_sysfs(struct cpuidle_device *device)
365 363
366/** 364/**
367 * cpuidle_add_sysfs - creates a sysfs instance for the target device 365 * cpuidle_add_sysfs - creates a sysfs instance for the target device
368 * @sysdev: the target device 366 * @dev: the target device
369 */ 367 */
370int cpuidle_add_sysfs(struct sys_device *sysdev) 368int cpuidle_add_sysfs(struct device *cpu_dev)
371{ 369{
372 int cpu = sysdev->id; 370 int cpu = cpu_dev->id;
373 struct cpuidle_device *dev; 371 struct cpuidle_device *dev;
374 int error; 372 int error;
375 373
376 dev = per_cpu(cpuidle_devices, cpu); 374 dev = per_cpu(cpuidle_devices, cpu);
377 error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &sysdev->kobj, 375 error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &cpu_dev->kobj,
378 "cpuidle"); 376 "cpuidle");
379 if (!error) 377 if (!error)
380 kobject_uevent(&dev->kobj, KOBJ_ADD); 378 kobject_uevent(&dev->kobj, KOBJ_ADD);
@@ -383,11 +381,11 @@ int cpuidle_add_sysfs(struct sys_device *sysdev)
383 381
384/** 382/**
385 * cpuidle_remove_sysfs - deletes a sysfs instance on the target device 383 * cpuidle_remove_sysfs - deletes a sysfs instance on the target device
386 * @sysdev: the target device 384 * @dev: the target device
387 */ 385 */
388void cpuidle_remove_sysfs(struct sys_device *sysdev) 386void cpuidle_remove_sysfs(struct device *cpu_dev)
389{ 387{
390 int cpu = sysdev->id; 388 int cpu = cpu_dev->id;
391 struct cpuidle_device *dev; 389 struct cpuidle_device *dev;
392 390
393 dev = per_cpu(cpuidle_devices, cpu); 391 dev = per_cpu(cpuidle_devices, cpu);
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index fe90cd4a7ebc..e48ab3108ad8 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -32,7 +32,6 @@
32#include <linux/completion.h> 32#include <linux/completion.h>
33#include <linux/kobject.h> 33#include <linux/kobject.h>
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/sysdev.h>
36#include <linux/workqueue.h> 35#include <linux/workqueue.h>
37#include <linux/edac.h> 36#include <linux/edac.h>
38 37
@@ -243,8 +242,8 @@ struct edac_device_ctl_info {
243 */ 242 */
244 struct edac_dev_sysfs_attribute *sysfs_attributes; 243 struct edac_dev_sysfs_attribute *sysfs_attributes;
245 244
246 /* pointer to main 'edac' class in sysfs */ 245 /* pointer to main 'edac' subsys in sysfs */
247 struct sysdev_class *edac_class; 246 struct bus_type *edac_subsys;
248 247
249 /* the internal state of this controller instance */ 248 /* the internal state of this controller instance */
250 int op_state; 249 int op_state;
@@ -342,7 +341,7 @@ struct edac_pci_ctl_info {
342 341
343 int pci_idx; 342 int pci_idx;
344 343
345 struct sysdev_class *edac_class; /* pointer to class */ 344 struct bus_type *edac_subsys; /* pointer to subsystem */
346 345
347 /* the internal state of this controller instance */ 346 /* the internal state of this controller instance */
348 int op_state; 347 int op_state;
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index c3f67437afb6..4b154593343a 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -23,7 +23,6 @@
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/sysdev.h>
27#include <linux/ctype.h> 26#include <linux/ctype.h>
28#include <linux/workqueue.h> 27#include <linux/workqueue.h>
29#include <asm/uaccess.h> 28#include <asm/uaccess.h>
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 86649df00285..b4ea185ccebf 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * file for managing the edac_device class of devices for EDAC 2 * file for managing the edac_device subsystem of devices for EDAC
3 * 3 *
4 * (C) 2007 SoftwareBitMaker 4 * (C) 2007 SoftwareBitMaker
5 * 5 *
@@ -230,21 +230,21 @@ static struct kobj_type ktype_device_ctrl = {
230 */ 230 */
231int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) 231int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
232{ 232{
233 struct sysdev_class *edac_class; 233 struct bus_type *edac_subsys;
234 int err; 234 int err;
235 235
236 debugf1("%s()\n", __func__); 236 debugf1("%s()\n", __func__);
237 237
238 /* get the /sys/devices/system/edac reference */ 238 /* get the /sys/devices/system/edac reference */
239 edac_class = edac_get_sysfs_class(); 239 edac_subsys = edac_get_sysfs_subsys();
240 if (edac_class == NULL) { 240 if (edac_subsys == NULL) {
241 debugf1("%s() no edac_class error\n", __func__); 241 debugf1("%s() no edac_subsys error\n", __func__);
242 err = -ENODEV; 242 err = -ENODEV;
243 goto err_out; 243 goto err_out;
244 } 244 }
245 245
246 /* Point to the 'edac_class' this instance 'reports' to */ 246 /* Point to the 'edac_subsys' this instance 'reports' to */
247 edac_dev->edac_class = edac_class; 247 edac_dev->edac_subsys = edac_subsys;
248 248
249 /* Init the devices's kobject */ 249 /* Init the devices's kobject */
250 memset(&edac_dev->kobj, 0, sizeof(struct kobject)); 250 memset(&edac_dev->kobj, 0, sizeof(struct kobject));
@@ -261,7 +261,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
261 261
262 /* register */ 262 /* register */
263 err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl, 263 err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl,
264 &edac_class->kset.kobj, 264 &edac_subsys->dev_root->kobj,
265 "%s", edac_dev->name); 265 "%s", edac_dev->name);
266 if (err) { 266 if (err) {
267 debugf1("%s()Failed to register '.../edac/%s'\n", 267 debugf1("%s()Failed to register '.../edac/%s'\n",
@@ -284,7 +284,7 @@ err_kobj_reg:
284 module_put(edac_dev->owner); 284 module_put(edac_dev->owner);
285 285
286err_mod_get: 286err_mod_get:
287 edac_put_sysfs_class(); 287 edac_put_sysfs_subsys();
288 288
289err_out: 289err_out:
290 return err; 290 return err;
@@ -308,7 +308,7 @@ void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev)
308 * b) 'kfree' the memory 308 * b) 'kfree' the memory
309 */ 309 */
310 kobject_put(&dev->kobj); 310 kobject_put(&dev->kobj);
311 edac_put_sysfs_class(); 311 edac_put_sysfs_subsys();
312} 312}
313 313
314/* edac_dev -> instance information */ 314/* edac_dev -> instance information */
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index d69144a09043..ca6c04d350ee 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -25,7 +25,6 @@
25#include <linux/jiffies.h> 25#include <linux/jiffies.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/sysdev.h>
29#include <linux/ctype.h> 28#include <linux/ctype.h>
30#include <linux/edac.h> 29#include <linux/edac.h>
31#include <asm/uaccess.h> 30#include <asm/uaccess.h>
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 29ffa350bfbe..d56e63477d5c 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -1021,19 +1021,19 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
1021int edac_sysfs_setup_mc_kset(void) 1021int edac_sysfs_setup_mc_kset(void)
1022{ 1022{
1023 int err = -EINVAL; 1023 int err = -EINVAL;
1024 struct sysdev_class *edac_class; 1024 struct bus_type *edac_subsys;
1025 1025
1026 debugf1("%s()\n", __func__); 1026 debugf1("%s()\n", __func__);
1027 1027
1028 /* get the /sys/devices/system/edac class reference */ 1028 /* get the /sys/devices/system/edac subsys reference */
1029 edac_class = edac_get_sysfs_class(); 1029 edac_subsys = edac_get_sysfs_subsys();
1030 if (edac_class == NULL) { 1030 if (edac_subsys == NULL) {
1031 debugf1("%s() no edac_class error=%d\n", __func__, err); 1031 debugf1("%s() no edac_subsys error=%d\n", __func__, err);
1032 goto fail_out; 1032 goto fail_out;
1033 } 1033 }
1034 1034
1035 /* Init the MC's kobject */ 1035 /* Init the MC's kobject */
1036 mc_kset = kset_create_and_add("mc", NULL, &edac_class->kset.kobj); 1036 mc_kset = kset_create_and_add("mc", NULL, &edac_subsys->dev_root->kobj);
1037 if (!mc_kset) { 1037 if (!mc_kset) {
1038 err = -ENOMEM; 1038 err = -ENOMEM;
1039 debugf1("%s() Failed to register '.../edac/mc'\n", __func__); 1039 debugf1("%s() Failed to register '.../edac/mc'\n", __func__);
@@ -1045,7 +1045,7 @@ int edac_sysfs_setup_mc_kset(void)
1045 return 0; 1045 return 0;
1046 1046
1047fail_kset: 1047fail_kset:
1048 edac_put_sysfs_class(); 1048 edac_put_sysfs_subsys();
1049 1049
1050fail_out: 1050fail_out:
1051 return err; 1051 return err;
@@ -1059,6 +1059,6 @@ fail_out:
1059void edac_sysfs_teardown_mc_kset(void) 1059void edac_sysfs_teardown_mc_kset(void)
1060{ 1060{
1061 kset_unregister(mc_kset); 1061 kset_unregister(mc_kset);
1062 edac_put_sysfs_class(); 1062 edac_put_sysfs_subsys();
1063} 1063}
1064 1064
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index 17aabb7b90ec..00f81b47a51f 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -10,8 +10,6 @@
10#ifndef __EDAC_MODULE_H__ 10#ifndef __EDAC_MODULE_H__
11#define __EDAC_MODULE_H__ 11#define __EDAC_MODULE_H__
12 12
13#include <linux/sysdev.h>
14
15#include "edac_core.h" 13#include "edac_core.h"
16 14
17/* 15/*
diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c
index 2b378207d571..63af1c5673d1 100644
--- a/drivers/edac/edac_pci.c
+++ b/drivers/edac/edac_pci.c
@@ -19,7 +19,6 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/sysdev.h>
23#include <linux/ctype.h> 22#include <linux/ctype.h>
24#include <linux/workqueue.h> 23#include <linux/workqueue.h>
25#include <asm/uaccess.h> 24#include <asm/uaccess.h>
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c
index 495198ad059c..97f5064e3992 100644
--- a/drivers/edac/edac_pci_sysfs.c
+++ b/drivers/edac/edac_pci_sysfs.c
@@ -338,12 +338,12 @@ static struct kobj_type ktype_edac_pci_main_kobj = {
338 * edac_pci_main_kobj_setup() 338 * edac_pci_main_kobj_setup()
339 * 339 *
340 * setup the sysfs for EDAC PCI attributes 340 * setup the sysfs for EDAC PCI attributes
341 * assumes edac_class has already been initialized 341 * assumes edac_subsys has already been initialized
342 */ 342 */
343static int edac_pci_main_kobj_setup(void) 343static int edac_pci_main_kobj_setup(void)
344{ 344{
345 int err; 345 int err;
346 struct sysdev_class *edac_class; 346 struct bus_type *edac_subsys;
347 347
348 debugf0("%s()\n", __func__); 348 debugf0("%s()\n", __func__);
349 349
@@ -354,9 +354,9 @@ static int edac_pci_main_kobj_setup(void)
354 /* First time, so create the main kobject and its 354 /* First time, so create the main kobject and its
355 * controls and attributes 355 * controls and attributes
356 */ 356 */
357 edac_class = edac_get_sysfs_class(); 357 edac_subsys = edac_get_sysfs_subsys();
358 if (edac_class == NULL) { 358 if (edac_subsys == NULL) {
359 debugf1("%s() no edac_class\n", __func__); 359 debugf1("%s() no edac_subsys\n", __func__);
360 err = -ENODEV; 360 err = -ENODEV;
361 goto decrement_count_fail; 361 goto decrement_count_fail;
362 } 362 }
@@ -381,7 +381,7 @@ static int edac_pci_main_kobj_setup(void)
381 /* Instanstiate the pci object */ 381 /* Instanstiate the pci object */
382 err = kobject_init_and_add(edac_pci_top_main_kobj, 382 err = kobject_init_and_add(edac_pci_top_main_kobj,
383 &ktype_edac_pci_main_kobj, 383 &ktype_edac_pci_main_kobj,
384 &edac_class->kset.kobj, "pci"); 384 &edac_subsys->dev_root->kobj, "pci");
385 if (err) { 385 if (err) {
386 debugf1("Failed to register '.../edac/pci'\n"); 386 debugf1("Failed to register '.../edac/pci'\n");
387 goto kobject_init_and_add_fail; 387 goto kobject_init_and_add_fail;
@@ -404,7 +404,7 @@ kzalloc_fail:
404 module_put(THIS_MODULE); 404 module_put(THIS_MODULE);
405 405
406mod_get_fail: 406mod_get_fail:
407 edac_put_sysfs_class(); 407 edac_put_sysfs_subsys();
408 408
409decrement_count_fail: 409decrement_count_fail:
410 /* if are on this error exit, nothing to tear down */ 410 /* if are on this error exit, nothing to tear down */
@@ -432,7 +432,7 @@ static void edac_pci_main_kobj_teardown(void)
432 __func__); 432 __func__);
433 kobject_put(edac_pci_top_main_kobj); 433 kobject_put(edac_pci_top_main_kobj);
434 } 434 }
435 edac_put_sysfs_class(); 435 edac_put_sysfs_subsys();
436} 436}
437 437
438/* 438/*
diff --git a/drivers/edac/edac_stub.c b/drivers/edac/edac_stub.c
index 86ad2eee1201..670c4481453b 100644
--- a/drivers/edac/edac_stub.c
+++ b/drivers/edac/edac_stub.c
@@ -26,7 +26,7 @@ EXPORT_SYMBOL_GPL(edac_handlers);
26int edac_err_assert = 0; 26int edac_err_assert = 0;
27EXPORT_SYMBOL_GPL(edac_err_assert); 27EXPORT_SYMBOL_GPL(edac_err_assert);
28 28
29static atomic_t edac_class_valid = ATOMIC_INIT(0); 29static atomic_t edac_subsys_valid = ATOMIC_INIT(0);
30 30
31/* 31/*
32 * called to determine if there is an EDAC driver interested in 32 * called to determine if there is an EDAC driver interested in
@@ -54,36 +54,37 @@ EXPORT_SYMBOL_GPL(edac_atomic_assert_error);
54 * sysfs object: /sys/devices/system/edac 54 * sysfs object: /sys/devices/system/edac
55 * need to export to other files 55 * need to export to other files
56 */ 56 */
57struct sysdev_class edac_class = { 57struct bus_type edac_subsys = {
58 .name = "edac", 58 .name = "edac",
59 .dev_name = "edac",
59}; 60};
60EXPORT_SYMBOL_GPL(edac_class); 61EXPORT_SYMBOL_GPL(edac_subsys);
61 62
62/* return pointer to the 'edac' node in sysfs */ 63/* return pointer to the 'edac' node in sysfs */
63struct sysdev_class *edac_get_sysfs_class(void) 64struct bus_type *edac_get_sysfs_subsys(void)
64{ 65{
65 int err = 0; 66 int err = 0;
66 67
67 if (atomic_read(&edac_class_valid)) 68 if (atomic_read(&edac_subsys_valid))
68 goto out; 69 goto out;
69 70
70 /* create the /sys/devices/system/edac directory */ 71 /* create the /sys/devices/system/edac directory */
71 err = sysdev_class_register(&edac_class); 72 err = subsys_system_register(&edac_subsys, NULL);
72 if (err) { 73 if (err) {
73 printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n"); 74 printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n");
74 return NULL; 75 return NULL;
75 } 76 }
76 77
77out: 78out:
78 atomic_inc(&edac_class_valid); 79 atomic_inc(&edac_subsys_valid);
79 return &edac_class; 80 return &edac_subsys;
80} 81}
81EXPORT_SYMBOL_GPL(edac_get_sysfs_class); 82EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys);
82 83
83void edac_put_sysfs_class(void) 84void edac_put_sysfs_subsys(void)
84{ 85{
85 /* last user unregisters it */ 86 /* last user unregisters it */
86 if (atomic_dec_and_test(&edac_class_valid)) 87 if (atomic_dec_and_test(&edac_subsys_valid))
87 sysdev_class_unregister(&edac_class); 88 bus_unregister(&edac_subsys);
88} 89}
89EXPORT_SYMBOL_GPL(edac_put_sysfs_class); 90EXPORT_SYMBOL_GPL(edac_put_sysfs_subsys);
diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index 73c3e26a0bce..885e8ad8fdcf 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/kobject.h> 13#include <linux/kobject.h>
14#include <linux/sysdev.h>
15#include <linux/edac.h> 14#include <linux/edac.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <asm/mce.h> 16#include <asm/mce.h>
@@ -116,14 +115,14 @@ static struct edac_mce_attr *sysfs_attrs[] = { &mce_attr_status, &mce_attr_misc,
116 115
117static int __init edac_init_mce_inject(void) 116static int __init edac_init_mce_inject(void)
118{ 117{
119 struct sysdev_class *edac_class = NULL; 118 struct bus_type *edac_subsys = NULL;
120 int i, err = 0; 119 int i, err = 0;
121 120
122 edac_class = edac_get_sysfs_class(); 121 edac_subsys = edac_get_sysfs_subsys();
123 if (!edac_class) 122 if (!edac_subsys)
124 return -EINVAL; 123 return -EINVAL;
125 124
126 mce_kobj = kobject_create_and_add("mce", &edac_class->kset.kobj); 125 mce_kobj = kobject_create_and_add("mce", &edac_subsys->dev_root->kobj);
127 if (!mce_kobj) { 126 if (!mce_kobj) {
128 printk(KERN_ERR "Error creating a mce kset.\n"); 127 printk(KERN_ERR "Error creating a mce kset.\n");
129 err = -ENOMEM; 128 err = -ENOMEM;
@@ -147,7 +146,7 @@ err_sysfs_create:
147 kobject_del(mce_kobj); 146 kobject_del(mce_kobj);
148 147
149err_mce_kobj: 148err_mce_kobj:
150 edac_put_sysfs_class(); 149 edac_put_sysfs_subsys();
151 150
152 return err; 151 return err;
153} 152}
@@ -161,7 +160,7 @@ static void __exit edac_exit_mce_inject(void)
161 160
162 kobject_del(mce_kobj); 161 kobject_del(mce_kobj);
163 162
164 edac_put_sysfs_class(); 163 edac_put_sysfs_subsys();
165} 164}
166 165
167module_init(edac_init_mce_inject); 166module_init(edac_init_mce_inject);
diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index c4e7c59d1c63..91ddf0f7a1b9 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -345,7 +345,8 @@ static efi_status_t gsmi_get_variable(efi_char16_t *name,
345 memcpy(&param, gsmi_dev.param_buf->start, sizeof(param)); 345 memcpy(&param, gsmi_dev.param_buf->start, sizeof(param));
346 346
347 /* The size reported is the min of all of our buffers */ 347 /* The size reported is the min of all of our buffers */
348 *data_size = min(*data_size, gsmi_dev.data_buf->length); 348 *data_size = min_t(unsigned long, *data_size,
349 gsmi_dev.data_buf->length);
349 *data_size = min_t(unsigned long, *data_size, param.data_len); 350 *data_size = min_t(unsigned long, *data_size, param.data_len);
350 351
351 /* Copy data back to return buffer. */ 352 /* Copy data back to return buffer. */
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 866251852719..dcbe4541fe49 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -22,7 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/sysdev.h> 25#include <linux/device.h>
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27 27
28#include <asm/irq.h> 28#include <asm/irq.h>
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index 065817329f03..bc445d7e3bf5 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -354,19 +354,4 @@ static struct usb_driver usb_kbd_driver = {
354 .id_table = usb_kbd_id_table, 354 .id_table = usb_kbd_id_table,
355}; 355};
356 356
357static int __init usb_kbd_init(void) 357module_usb_driver(usb_kbd_driver);
358{
359 int result = usb_register(&usb_kbd_driver);
360 if (result == 0)
361 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
362 DRIVER_DESC "\n");
363 return result;
364}
365
366static void __exit usb_kbd_exit(void)
367{
368 usb_deregister(&usb_kbd_driver);
369}
370
371module_init(usb_kbd_init);
372module_exit(usb_kbd_exit);
diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c
index 79b2bf81a059..0f6be45d43d5 100644
--- a/drivers/hid/usbhid/usbmouse.c
+++ b/drivers/hid/usbhid/usbmouse.c
@@ -241,19 +241,4 @@ static struct usb_driver usb_mouse_driver = {
241 .id_table = usb_mouse_id_table, 241 .id_table = usb_mouse_id_table,
242}; 242};
243 243
244static int __init usb_mouse_init(void) 244module_usb_driver(usb_mouse_driver);
245{
246 int retval = usb_register(&usb_mouse_driver);
247 if (retval == 0)
248 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
249 DRIVER_DESC "\n");
250 return retval;
251}
252
253static void __exit usb_mouse_exit(void)
254{
255 usb_deregister(&usb_mouse_driver);
256}
257
258module_init(usb_mouse_init);
259module_exit(usb_mouse_exit);
diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
index 9fa09ac000ad..70f5dde1cc52 100644
--- a/drivers/hv/Kconfig
+++ b/drivers/hv/Kconfig
@@ -1,3 +1,5 @@
1menu "Microsoft Hyper-V guest support"
2
1config HYPERV 3config HYPERV
2 tristate "Microsoft Hyper-V client drivers" 4 tristate "Microsoft Hyper-V client drivers"
3 depends on X86 && ACPI && PCI 5 depends on X86 && ACPI && PCI
@@ -11,4 +13,4 @@ config HYPERV_UTILS
11 help 13 help
12 Select this option to enable the Hyper-V Utilities. 14 Select this option to enable the Hyper-V Utilities.
13 15
14 16endmenu
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 12b85ff957fd..36484db36baf 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -223,6 +223,17 @@ static void vmbus_process_rescind_offer(struct work_struct *work)
223 vmbus_device_unregister(channel->device_obj); 223 vmbus_device_unregister(channel->device_obj);
224} 224}
225 225
226void vmbus_free_channels(void)
227{
228 struct vmbus_channel *channel;
229
230 list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
231 vmbus_device_unregister(channel->device_obj);
232 kfree(channel->device_obj);
233 free_channel(channel);
234 }
235}
236
226/* 237/*
227 * vmbus_process_offer - Process the offer by creating a channel/device 238 * vmbus_process_offer - Process the offer by creating a channel/device
228 * associated with this offer 239 * associated with this offer
@@ -287,6 +298,7 @@ static void vmbus_process_offer(struct work_struct *work)
287 spin_lock_irqsave(&vmbus_connection.channel_lock, flags); 298 spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
288 list_del(&newchannel->listentry); 299 list_del(&newchannel->listentry);
289 spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags); 300 spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
301 kfree(newchannel->device_obj);
290 302
291 free_channel(newchannel); 303 free_channel(newchannel);
292 } else { 304 } else {
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 0fb100ed91a3..12aa97f31f93 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -164,11 +164,6 @@ int hv_init(void)
164 164
165 max_leaf = query_hypervisor_info(); 165 max_leaf = query_hypervisor_info();
166 166
167 rdmsrl(HV_X64_MSR_GUEST_OS_ID, hv_context.guestid);
168
169 if (hv_context.guestid != 0)
170 goto cleanup;
171
172 /* Write our OS info */ 167 /* Write our OS info */
173 wrmsrl(HV_X64_MSR_GUEST_OS_ID, HV_LINUX_GUEST_ID); 168 wrmsrl(HV_X64_MSR_GUEST_OS_ID, HV_LINUX_GUEST_ID);
174 hv_context.guestid = HV_LINUX_GUEST_ID; 169 hv_context.guestid = HV_LINUX_GUEST_ID;
@@ -237,6 +232,9 @@ void hv_cleanup(void)
237{ 232{
238 union hv_x64_msr_hypercall_contents hypercall_msr; 233 union hv_x64_msr_hypercall_contents hypercall_msr;
239 234
235 /* Reset our OS id */
236 wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0);
237
240 kfree(hv_context.signal_event_buffer); 238 kfree(hv_context.signal_event_buffer);
241 hv_context.signal_event_buffer = NULL; 239 hv_context.signal_event_buffer = NULL;
242 hv_context.signal_event_param = NULL; 240 hv_context.signal_event_param = NULL;
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 0aee1122734c..6d7d286d5440 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -611,6 +611,7 @@ void vmbus_device_unregister(struct hv_device *device_obj);
611 611
612struct vmbus_channel *relid2channel(u32 relid); 612struct vmbus_channel *relid2channel(u32 relid);
613 613
614void vmbus_free_channels(void);
614 615
615/* Connection interface */ 616/* Connection interface */
616 617
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 0c048dd8013f..a220e5746d67 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -62,6 +62,14 @@ struct hv_device_info {
62 struct hv_dev_port_info outbound; 62 struct hv_dev_port_info outbound;
63}; 63};
64 64
65static int vmbus_exists(void)
66{
67 if (hv_acpi_dev == NULL)
68 return -ENODEV;
69
70 return 0;
71}
72
65 73
66static void get_channel_info(struct hv_device *device, 74static void get_channel_info(struct hv_device *device,
67 struct hv_device_info *info) 75 struct hv_device_info *info)
@@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, c
590 598
591 pr_info("registering driver %s\n", hv_driver->name); 599 pr_info("registering driver %s\n", hv_driver->name);
592 600
601 ret = vmbus_exists();
602 if (ret < 0)
603 return ret;
604
593 hv_driver->driver.name = hv_driver->name; 605 hv_driver->driver.name = hv_driver->name;
594 hv_driver->driver.owner = owner; 606 hv_driver->driver.owner = owner;
595 hv_driver->driver.mod_name = mod_name; 607 hv_driver->driver.mod_name = mod_name;
@@ -614,8 +626,8 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver)
614{ 626{
615 pr_info("unregistering driver %s\n", hv_driver->name); 627 pr_info("unregistering driver %s\n", hv_driver->name);
616 628
617 driver_unregister(&hv_driver->driver); 629 if (!vmbus_exists())
618 630 driver_unregister(&hv_driver->driver);
619} 631}
620EXPORT_SYMBOL_GPL(vmbus_driver_unregister); 632EXPORT_SYMBOL_GPL(vmbus_driver_unregister);
621 633
@@ -776,11 +788,23 @@ static int __init hv_acpi_init(void)
776 788
777cleanup: 789cleanup:
778 acpi_bus_unregister_driver(&vmbus_acpi_driver); 790 acpi_bus_unregister_driver(&vmbus_acpi_driver);
791 hv_acpi_dev = NULL;
779 return ret; 792 return ret;
780} 793}
781 794
795static void __exit vmbus_exit(void)
796{
797
798 free_irq(irq, hv_acpi_dev);
799 vmbus_free_channels();
800 bus_unregister(&hv_bus);
801 hv_cleanup();
802 acpi_bus_unregister_driver(&vmbus_acpi_driver);
803}
804
782 805
783MODULE_LICENSE("GPL"); 806MODULE_LICENSE("GPL");
784MODULE_VERSION(HV_DRV_VERSION); 807MODULE_VERSION(HV_DRV_VERSION);
785 808
786module_init(hv_acpi_init); 809subsys_initcall(hv_acpi_init);
810module_exit(vmbus_exit);
diff --git a/drivers/i2c/busses/i2c-diolan-u2c.c b/drivers/i2c/busses/i2c-diolan-u2c.c
index 76366716a854..7eb19a5222f2 100644
--- a/drivers/i2c/busses/i2c-diolan-u2c.c
+++ b/drivers/i2c/busses/i2c-diolan-u2c.c
@@ -515,20 +515,7 @@ static struct usb_driver diolan_u2c_driver = {
515 .id_table = diolan_u2c_table, 515 .id_table = diolan_u2c_table,
516}; 516};
517 517
518static int __init diolan_u2c_init(void) 518module_usb_driver(diolan_u2c_driver);
519{
520 /* register this driver with the USB subsystem */
521 return usb_register(&diolan_u2c_driver);
522}
523
524static void __exit diolan_u2c_exit(void)
525{
526 /* deregister this driver with the USB subsystem */
527 usb_deregister(&diolan_u2c_driver);
528}
529
530module_init(diolan_u2c_init);
531module_exit(diolan_u2c_exit);
532 519
533MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); 520MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>");
534MODULE_DESCRIPTION(DRIVER_NAME " driver"); 521MODULE_DESCRIPTION(DRIVER_NAME " driver");
diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
index d03b04002f0d..f07307ff360d 100644
--- a/drivers/i2c/busses/i2c-tiny-usb.c
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -262,20 +262,7 @@ static struct usb_driver i2c_tiny_usb_driver = {
262 .id_table = i2c_tiny_usb_table, 262 .id_table = i2c_tiny_usb_table,
263}; 263};
264 264
265static int __init usb_i2c_tiny_usb_init(void) 265module_usb_driver(i2c_tiny_usb_driver);
266{
267 /* register this driver with the USB subsystem */
268 return usb_register(&i2c_tiny_usb_driver);
269}
270
271static void __exit usb_i2c_tiny_usb_exit(void)
272{
273 /* deregister this driver with the USB subsystem */
274 usb_deregister(&i2c_tiny_usb_driver);
275}
276
277module_init(usb_i2c_tiny_usb_init);
278module_exit(usb_i2c_tiny_usb_exit);
279 266
280/* ----- end of usb layer ------------------------------------------------ */ 267/* ----- end of usb layer ------------------------------------------------ */
281 268
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index d72887585a14..32bbd4c77b7c 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -1041,18 +1041,7 @@ static struct usb_driver xpad_driver = {
1041 .id_table = xpad_table, 1041 .id_table = xpad_table,
1042}; 1042};
1043 1043
1044static int __init usb_xpad_init(void) 1044module_usb_driver(xpad_driver);
1045{
1046 return usb_register(&xpad_driver);
1047}
1048
1049static void __exit usb_xpad_exit(void)
1050{
1051 usb_deregister(&xpad_driver);
1052}
1053
1054module_init(usb_xpad_init);
1055module_exit(usb_xpad_exit);
1056 1045
1057MODULE_AUTHOR(DRIVER_AUTHOR); 1046MODULE_AUTHOR(DRIVER_AUTHOR);
1058MODULE_DESCRIPTION(DRIVER_DESC); 1047MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 8d345e87075e..874a51c2fbb2 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -1010,23 +1010,4 @@ static int ati_remote2_post_reset(struct usb_interface *interface)
1010 return r; 1010 return r;
1011} 1011}
1012 1012
1013static int __init ati_remote2_init(void) 1013module_usb_driver(ati_remote2_driver);
1014{
1015 int r;
1016
1017 r = usb_register(&ati_remote2_driver);
1018 if (r)
1019 printk(KERN_ERR "ati_remote2: usb_register() = %d\n", r);
1020 else
1021 printk(KERN_INFO "ati_remote2: " DRIVER_DESC " " DRIVER_VERSION "\n");
1022
1023 return r;
1024}
1025
1026static void __exit ati_remote2_exit(void)
1027{
1028 usb_deregister(&ati_remote2_driver);
1029}
1030
1031module_init(ati_remote2_init);
1032module_exit(ati_remote2_exit);
diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index fc62256c963f..d99151a8bf10 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -580,26 +580,7 @@ static struct usb_driver keyspan_driver =
580 .id_table = keyspan_table 580 .id_table = keyspan_table
581}; 581};
582 582
583static int __init usb_keyspan_init(void) 583module_usb_driver(keyspan_driver);
584{
585 int result;
586
587 /* register this driver with the USB subsystem */
588 result = usb_register(&keyspan_driver);
589 if (result)
590 err("usb_register failed. Error number %d\n", result);
591
592 return result;
593}
594
595static void __exit usb_keyspan_exit(void)
596{
597 /* deregister this driver with the USB subsystem */
598 usb_deregister(&keyspan_driver);
599}
600
601module_init(usb_keyspan_init);
602module_exit(usb_keyspan_exit);
603 584
604MODULE_DEVICE_TABLE(usb, keyspan_table); 585MODULE_DEVICE_TABLE(usb, keyspan_table);
605MODULE_AUTHOR(DRIVER_AUTHOR); 586MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index f45947190e4f..538f7049ec64 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -441,18 +441,7 @@ static struct usb_driver powermate_driver = {
441 .id_table = powermate_devices, 441 .id_table = powermate_devices,
442}; 442};
443 443
444static int __init powermate_init(void) 444module_usb_driver(powermate_driver);
445{
446 return usb_register(&powermate_driver);
447}
448
449static void __exit powermate_cleanup(void)
450{
451 usb_deregister(&powermate_driver);
452}
453
454module_init(powermate_init);
455module_exit(powermate_cleanup);
456 445
457MODULE_AUTHOR( "William R Sowerbutts" ); 446MODULE_AUTHOR( "William R Sowerbutts" );
458MODULE_DESCRIPTION( "Griffin Technology, Inc PowerMate driver" ); 447MODULE_DESCRIPTION( "Griffin Technology, Inc PowerMate driver" );
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 41201c6b5e68..f4776e7f8c15 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -988,22 +988,7 @@ static struct usb_driver yealink_driver = {
988 .id_table = usb_table, 988 .id_table = usb_table,
989}; 989};
990 990
991static int __init yealink_dev_init(void) 991module_usb_driver(yealink_driver);
992{
993 int ret = usb_register(&yealink_driver);
994 if (ret == 0)
995 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
996 DRIVER_DESC "\n");
997 return ret;
998}
999
1000static void __exit yealink_dev_exit(void)
1001{
1002 usb_deregister(&yealink_driver);
1003}
1004
1005module_init(yealink_dev_init);
1006module_exit(yealink_dev_exit);
1007 992
1008MODULE_DEVICE_TABLE (usb, usb_table); 993MODULE_DEVICE_TABLE (usb, usb_table);
1009 994
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index b77f9991278e..0acbc7d50d05 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -938,15 +938,4 @@ static struct usb_driver atp_driver = {
938 .id_table = atp_table, 938 .id_table = atp_table,
939}; 939};
940 940
941static int __init atp_init(void) 941module_usb_driver(atp_driver);
942{
943 return usb_register(&atp_driver);
944}
945
946static void __exit atp_exit(void)
947{
948 usb_deregister(&atp_driver);
949}
950
951module_init(atp_init);
952module_exit(atp_exit);
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 5ec617e28f7e..cf87f8b18e34 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -940,16 +940,4 @@ static struct usb_driver bcm5974_driver = {
940 .supports_autosuspend = 1, 940 .supports_autosuspend = 1,
941}; 941};
942 942
943static int __init bcm5974_init(void) 943module_usb_driver(bcm5974_driver);
944{
945 return usb_register(&bcm5974_driver);
946}
947
948static void __exit bcm5974_exit(void)
949{
950 usb_deregister(&bcm5974_driver);
951}
952
953module_init(bcm5974_init);
954module_exit(bcm5974_exit);
955
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index d94f7e9aa997..f8b0b1df9138 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -269,19 +269,4 @@ static struct usb_driver usb_acecad_driver = {
269 .id_table = usb_acecad_id_table, 269 .id_table = usb_acecad_id_table,
270}; 270};
271 271
272static int __init usb_acecad_init(void) 272module_usb_driver(usb_acecad_driver);
273{
274 int result = usb_register(&usb_acecad_driver);
275 if (result == 0)
276 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
277 DRIVER_DESC "\n");
278 return result;
279}
280
281static void __exit usb_acecad_exit(void)
282{
283 usb_deregister(&usb_acecad_driver);
284}
285
286module_init(usb_acecad_init);
287module_exit(usb_acecad_exit);
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 6d89fd1842c3..d5ef3debd045 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1919,21 +1919,7 @@ static struct usb_driver aiptek_driver = {
1919 .id_table = aiptek_ids, 1919 .id_table = aiptek_ids,
1920}; 1920};
1921 1921
1922static int __init aiptek_init(void) 1922module_usb_driver(aiptek_driver);
1923{
1924 int result = usb_register(&aiptek_driver);
1925 if (result == 0) {
1926 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1927 DRIVER_DESC "\n");
1928 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_AUTHOR "\n");
1929 }
1930 return result;
1931}
1932
1933static void __exit aiptek_exit(void)
1934{
1935 usb_deregister(&aiptek_driver);
1936}
1937 1923
1938MODULE_AUTHOR(DRIVER_AUTHOR); 1924MODULE_AUTHOR(DRIVER_AUTHOR);
1939MODULE_DESCRIPTION(DRIVER_DESC); 1925MODULE_DESCRIPTION(DRIVER_DESC);
@@ -1943,6 +1929,3 @@ module_param(programmableDelay, int, 0);
1943MODULE_PARM_DESC(programmableDelay, "delay used during tablet programming"); 1929MODULE_PARM_DESC(programmableDelay, "delay used during tablet programming");
1944module_param(jitterDelay, int, 0); 1930module_param(jitterDelay, int, 0);
1945MODULE_PARM_DESC(jitterDelay, "stylus/mouse settlement delay"); 1931MODULE_PARM_DESC(jitterDelay, "stylus/mouse settlement delay");
1946
1947module_init(aiptek_init);
1948module_exit(aiptek_exit);
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index 8ea6afe2e992..89a297801dce 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -1022,33 +1022,7 @@ static struct usb_driver gtco_driverinfo_table = {
1022 .disconnect = gtco_disconnect, 1022 .disconnect = gtco_disconnect,
1023}; 1023};
1024 1024
1025/* 1025module_usb_driver(gtco_driverinfo_table);
1026 * Register this module with the USB subsystem
1027 */
1028static int __init gtco_init(void)
1029{
1030 int error;
1031
1032 error = usb_register(&gtco_driverinfo_table);
1033 if (error) {
1034 err("usb_register() failed rc=0x%x", error);
1035 return error;
1036 }
1037
1038 printk("GTCO usb driver version: %s", GTCO_VERSION);
1039 return 0;
1040}
1041
1042/*
1043 * Deregister this module with the USB subsystem
1044 */
1045static void __exit gtco_exit(void)
1046{
1047 usb_deregister(&gtco_driverinfo_table);
1048}
1049
1050module_init(gtco_init);
1051module_exit(gtco_exit);
1052 1026
1053MODULE_DESCRIPTION("GTCO digitizer USB driver"); 1027MODULE_DESCRIPTION("GTCO digitizer USB driver");
1054MODULE_LICENSE("GPL"); 1028MODULE_LICENSE("GPL");
diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
index 6504b627b234..b2db3cfe3084 100644
--- a/drivers/input/tablet/hanwang.c
+++ b/drivers/input/tablet/hanwang.c
@@ -432,15 +432,4 @@ static struct usb_driver hanwang_driver = {
432 .id_table = hanwang_ids, 432 .id_table = hanwang_ids,
433}; 433};
434 434
435static int __init hanwang_init(void) 435module_usb_driver(hanwang_driver);
436{
437 return usb_register(&hanwang_driver);
438}
439
440static void __exit hanwang_exit(void)
441{
442 usb_deregister(&hanwang_driver);
443}
444
445module_init(hanwang_init);
446module_exit(hanwang_exit);
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index 290f4e57b589..85a5b40333ac 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -198,22 +198,4 @@ static struct usb_driver kbtab_driver = {
198 .id_table = kbtab_ids, 198 .id_table = kbtab_ids,
199}; 199};
200 200
201static int __init kbtab_init(void) 201module_usb_driver(kbtab_driver);
202{
203 int retval;
204 retval = usb_register(&kbtab_driver);
205 if (retval)
206 goto out;
207 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
208 DRIVER_DESC "\n");
209out:
210 return retval;
211}
212
213static void __exit kbtab_exit(void)
214{
215 usb_deregister(&kbtab_driver);
216}
217
218module_init(kbtab_init);
219module_exit(kbtab_exit);
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 1c1b7b43cf92..8f9cde3e0ec2 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -919,21 +919,4 @@ static struct usb_driver wacom_driver = {
919 .supports_autosuspend = 1, 919 .supports_autosuspend = 1,
920}; 920};
921 921
922static int __init wacom_init(void) 922module_usb_driver(wacom_driver);
923{
924 int result;
925
926 result = usb_register(&wacom_driver);
927 if (result == 0)
928 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
929 DRIVER_DESC "\n");
930 return result;
931}
932
933static void __exit wacom_exit(void)
934{
935 usb_deregister(&wacom_driver);
936}
937
938module_init(wacom_init);
939module_exit(wacom_exit);
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 73fd6642b681..e539d92cc626 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -1580,18 +1580,7 @@ static struct usb_driver usbtouch_driver = {
1580 .supports_autosuspend = 1, 1580 .supports_autosuspend = 1,
1581}; 1581};
1582 1582
1583static int __init usbtouch_init(void) 1583module_usb_driver(usbtouch_driver);
1584{
1585 return usb_register(&usbtouch_driver);
1586}
1587
1588static void __exit usbtouch_cleanup(void)
1589{
1590 usb_deregister(&usbtouch_driver);
1591}
1592
1593module_init(usbtouch_init);
1594module_exit(usbtouch_cleanup);
1595 1584
1596MODULE_AUTHOR(DRIVER_AUTHOR); 1585MODULE_AUTHOR(DRIVER_AUTHOR);
1597MODULE_DESCRIPTION(DRIVER_DESC); 1586MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 71a8eb6ef71e..0e1f4d5b9774 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -2154,30 +2154,4 @@ static struct usb_driver hfcsusb_drv = {
2154 .disconnect = hfcsusb_disconnect, 2154 .disconnect = hfcsusb_disconnect,
2155}; 2155};
2156 2156
2157static int __init 2157module_usb_driver(hfcsusb_drv);
2158hfcsusb_init(void)
2159{
2160 printk(KERN_INFO DRIVER_NAME " driver Rev. %s debug(0x%x) poll(%i)\n",
2161 hfcsusb_rev, debug, poll);
2162
2163 if (usb_register(&hfcsusb_drv)) {
2164 printk(KERN_INFO DRIVER_NAME
2165 ": Unable to register hfcsusb module at usb stack\n");
2166 return -ENODEV;
2167 }
2168
2169 return 0;
2170}
2171
2172static void __exit
2173hfcsusb_cleanup(void)
2174{
2175 if (debug & DBG_HFC_CALL_TRACE)
2176 printk(KERN_INFO DRIVER_NAME ": %s\n", __func__);
2177
2178 /* unregister Hardware */
2179 usb_deregister(&hfcsusb_drv); /* release our driver */
2180}
2181
2182module_init(hfcsusb_init);
2183module_exit(hfcsusb_cleanup);
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 6d5628bb0601..0c8739c448b1 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -15,7 +15,6 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/sysdev.h>
19#include <linux/timer.h> 18#include <linux/timer.h>
20#include <linux/err.h> 19#include <linux/err.h>
21#include <linux/ctype.h> 20#include <linux/ctype.h>
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 6f1ff93d7cec..46b4c766335d 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -17,7 +17,6 @@
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/sysdev.h>
21#include <linux/timer.h> 20#include <linux/timer.h>
22#include <linux/rwsem.h> 21#include <linux/rwsem.h>
23#include <linux/leds.h> 22#include <linux/leds.h>
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 116a49ce74b2..54ac7ffacb40 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -32,7 +32,6 @@
32#include <linux/completion.h> 32#include <linux/completion.h>
33#include <linux/miscdevice.h> 33#include <linux/miscdevice.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/sysdev.h>
36#include <linux/poll.h> 35#include <linux/poll.h>
37#include <linux/mutex.h> 36#include <linux/mutex.h>
38#include <linux/of_device.h> 37#include <linux/of_device.h>
@@ -681,9 +680,6 @@ static struct platform_driver smu_of_platform_driver =
681static int __init smu_init_sysfs(void) 680static int __init smu_init_sysfs(void)
682{ 681{
683 /* 682 /*
684 * Due to sysfs bogosity, a sysdev is not a real device, so
685 * we should in fact create both if we want sysdev semantics
686 * for power management.
687 * For now, we don't power manage machines with an SMU chip, 683 * For now, we don't power manage machines with an SMU chip,
688 * I'm a bit too far from figuring out how that works with those 684 * I'm a bit too far from figuring out how that works with those
689 * new chipsets, but that will come back and bite us 685 * new chipsets, but that will come back and bite us
diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c
index bedcfb671624..26c666dd3514 100644
--- a/drivers/media/dvb/b2c2/flexcop-usb.c
+++ b/drivers/media/dvb/b2c2/flexcop-usb.c
@@ -583,25 +583,7 @@ static struct usb_driver flexcop_usb_driver = {
583 .id_table = flexcop_usb_table, 583 .id_table = flexcop_usb_table,
584}; 584};
585 585
586/* module stuff */ 586module_usb_driver(flexcop_usb_driver);
587static int __init flexcop_usb_module_init(void)
588{
589 int result;
590 if ((result = usb_register(&flexcop_usb_driver))) {
591 err("usb_register failed. (%d)", result);
592 return result;
593 }
594 return 0;
595}
596
597static void __exit flexcop_usb_module_exit(void)
598{
599 /* deregister this driver from the USB subsystem */
600 usb_deregister(&flexcop_usb_driver);
601}
602
603module_init(flexcop_usb_module_init);
604module_exit(flexcop_usb_module_exit);
605 587
606MODULE_AUTHOR(DRIVER_AUTHOR); 588MODULE_AUTHOR(DRIVER_AUTHOR);
607MODULE_DESCRIPTION(DRIVER_NAME); 589MODULE_DESCRIPTION(DRIVER_NAME);
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c
index 2aef3c89e9fa..8d7fef84afd8 100644
--- a/drivers/media/dvb/dvb-usb/a800.c
+++ b/drivers/media/dvb/dvb-usb/a800.c
@@ -183,26 +183,7 @@ static struct usb_driver a800_driver = {
183 .id_table = a800_table, 183 .id_table = a800_table,
184}; 184};
185 185
186/* module stuff */ 186module_usb_driver(a800_driver);
187static int __init a800_module_init(void)
188{
189 int result;
190 if ((result = usb_register(&a800_driver))) {
191 err("usb_register failed. Error number %d",result);
192 return result;
193 }
194
195 return 0;
196}
197
198static void __exit a800_module_exit(void)
199{
200 /* deregister this driver from the USB subsystem */
201 usb_deregister(&a800_driver);
202}
203
204module_init (a800_module_init);
205module_exit (a800_module_exit);
206 187
207MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 188MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
208MODULE_DESCRIPTION("AVerMedia AverTV DVB-T USB 2.0 (A800)"); 189MODULE_DESCRIPTION("AVerMedia AverTV DVB-T USB 2.0 (A800)");
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c
index c6c275bac08e..56cbd3636c31 100644
--- a/drivers/media/dvb/dvb-usb/af9015.c
+++ b/drivers/media/dvb/dvb-usb/af9015.c
@@ -1713,25 +1713,7 @@ static struct usb_driver af9015_usb_driver = {
1713 .id_table = af9015_usb_table, 1713 .id_table = af9015_usb_table,
1714}; 1714};
1715 1715
1716/* module stuff */ 1716module_usb_driver(af9015_usb_driver);
1717static int __init af9015_usb_module_init(void)
1718{
1719 int ret;
1720 ret = usb_register(&af9015_usb_driver);
1721 if (ret)
1722 err("module init failed:%d", ret);
1723
1724 return ret;
1725}
1726
1727static void __exit af9015_usb_module_exit(void)
1728{
1729 /* deregister this driver from the USB subsystem */
1730 usb_deregister(&af9015_usb_driver);
1731}
1732
1733module_init(af9015_usb_module_init);
1734module_exit(af9015_usb_module_exit);
1735 1717
1736MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 1718MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1737MODULE_DESCRIPTION("Driver for Afatech AF9015 DVB-T"); 1719MODULE_DESCRIPTION("Driver for Afatech AF9015 DVB-T");
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c
index 5f2278b73ee9..b39f14f85e71 100644
--- a/drivers/media/dvb/dvb-usb/anysee.c
+++ b/drivers/media/dvb/dvb-usb/anysee.c
@@ -1091,26 +1091,7 @@ static struct usb_driver anysee_driver = {
1091 .id_table = anysee_table, 1091 .id_table = anysee_table,
1092}; 1092};
1093 1093
1094/* module stuff */ 1094module_usb_driver(anysee_driver);
1095static int __init anysee_module_init(void)
1096{
1097 int ret;
1098
1099 ret = usb_register(&anysee_driver);
1100 if (ret)
1101 err("%s: usb_register failed. Error number %d", __func__, ret);
1102
1103 return ret;
1104}
1105
1106static void __exit anysee_module_exit(void)
1107{
1108 /* deregister this driver from the USB subsystem */
1109 usb_deregister(&anysee_driver);
1110}
1111
1112module_init(anysee_module_init);
1113module_exit(anysee_module_exit);
1114 1095
1115MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 1096MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1116MODULE_DESCRIPTION("Driver Anysee E30 DVB-C & DVB-T USB2.0"); 1097MODULE_DESCRIPTION("Driver Anysee E30 DVB-C & DVB-T USB2.0");
diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c
index b77994967b9b..16210c060302 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -244,26 +244,7 @@ static struct usb_driver au6610_driver = {
244 .id_table = au6610_table, 244 .id_table = au6610_table,
245}; 245};
246 246
247/* module stuff */ 247module_usb_driver(au6610_driver);
248static int __init au6610_module_init(void)
249{
250 int ret;
251
252 ret = usb_register(&au6610_driver);
253 if (ret)
254 err("usb_register failed. Error number %d", ret);
255
256 return ret;
257}
258
259static void __exit au6610_module_exit(void)
260{
261 /* deregister this driver from the USB subsystem */
262 usb_deregister(&au6610_driver);
263}
264
265module_init(au6610_module_init);
266module_exit(au6610_module_exit);
267 248
268MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 249MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
269MODULE_DESCRIPTION("Driver for Alcor Micro AU6610 DVB-T USB2.0"); 250MODULE_DESCRIPTION("Driver for Alcor Micro AU6610 DVB-T USB2.0");
diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c
index bf67b4dfd82b..5e45ae605427 100644
--- a/drivers/media/dvb/dvb-usb/az6027.c
+++ b/drivers/media/dvb/dvb-usb/az6027.c
@@ -1174,28 +1174,7 @@ static struct usb_driver az6027_usb_driver = {
1174 .id_table = az6027_usb_table, 1174 .id_table = az6027_usb_table,
1175}; 1175};
1176 1176
1177/* module stuff */ 1177module_usb_driver(az6027_usb_driver);
1178static int __init az6027_usb_module_init(void)
1179{
1180 int result;
1181
1182 result = usb_register(&az6027_usb_driver);
1183 if (result) {
1184 err("usb_register failed. (%d)", result);
1185 return result;
1186 }
1187
1188 return 0;
1189}
1190
1191static void __exit az6027_usb_module_exit(void)
1192{
1193 /* deregister this driver from the USB subsystem */
1194 usb_deregister(&az6027_usb_driver);
1195}
1196
1197module_init(az6027_usb_module_init);
1198module_exit(az6027_usb_module_exit);
1199 1178
1200MODULE_AUTHOR("Adams Xu <Adams.xu@azwave.com.cn>"); 1179MODULE_AUTHOR("Adams Xu <Adams.xu@azwave.com.cn>");
1201MODULE_DESCRIPTION("Driver for AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)"); 1180MODULE_DESCRIPTION("Driver for AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)");
diff --git a/drivers/media/dvb/dvb-usb/ce6230.c b/drivers/media/dvb/dvb-usb/ce6230.c
index 57afb5a9157e..fa637255729c 100644
--- a/drivers/media/dvb/dvb-usb/ce6230.c
+++ b/drivers/media/dvb/dvb-usb/ce6230.c
@@ -317,27 +317,7 @@ static struct usb_driver ce6230_driver = {
317 .id_table = ce6230_table, 317 .id_table = ce6230_table,
318}; 318};
319 319
320/* module stuff */ 320module_usb_driver(ce6230_driver);
321static int __init ce6230_module_init(void)
322{
323 int ret;
324 deb_info("%s:\n", __func__);
325 ret = usb_register(&ce6230_driver);
326 if (ret)
327 err("usb_register failed with error:%d", ret);
328
329 return ret;
330}
331
332static void __exit ce6230_module_exit(void)
333{
334 deb_info("%s:\n", __func__);
335 /* deregister this driver from the USB subsystem */
336 usb_deregister(&ce6230_driver);
337}
338
339module_init(ce6230_module_init);
340module_exit(ce6230_module_exit);
341 321
342MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 322MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
343MODULE_DESCRIPTION("Driver for Intel CE6230 DVB-T USB2.0"); 323MODULE_DESCRIPTION("Driver for Intel CE6230 DVB-T USB2.0");
diff --git a/drivers/media/dvb/dvb-usb/cinergyT2-core.c b/drivers/media/dvb/dvb-usb/cinergyT2-core.c
index f9d905002ec9..0a98548ecd17 100644
--- a/drivers/media/dvb/dvb-usb/cinergyT2-core.c
+++ b/drivers/media/dvb/dvb-usb/cinergyT2-core.c
@@ -247,25 +247,7 @@ static struct usb_driver cinergyt2_driver = {
247 .id_table = cinergyt2_usb_table 247 .id_table = cinergyt2_usb_table
248}; 248};
249 249
250static int __init cinergyt2_usb_init(void) 250module_usb_driver(cinergyt2_driver);
251{
252 int err;
253
254 err = usb_register(&cinergyt2_driver);
255 if (err) {
256 err("usb_register() failed! (err %i)\n", err);
257 return err;
258 }
259 return 0;
260}
261
262static void __exit cinergyt2_usb_exit(void)
263{
264 usb_deregister(&cinergyt2_driver);
265}
266
267module_init(cinergyt2_usb_init);
268module_exit(cinergyt2_usb_exit);
269 251
270MODULE_DESCRIPTION("Terratec Cinergy T2 DVB-T driver"); 252MODULE_DESCRIPTION("Terratec Cinergy T2 DVB-T driver");
271MODULE_LICENSE("GPL"); 253MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 9f2a02c48377..949ea1bc0aae 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -2034,26 +2034,7 @@ static struct usb_driver cxusb_driver = {
2034 .id_table = cxusb_table, 2034 .id_table = cxusb_table,
2035}; 2035};
2036 2036
2037/* module stuff */ 2037module_usb_driver(cxusb_driver);
2038static int __init cxusb_module_init(void)
2039{
2040 int result;
2041 if ((result = usb_register(&cxusb_driver))) {
2042 err("usb_register failed. Error number %d",result);
2043 return result;
2044 }
2045
2046 return 0;
2047}
2048
2049static void __exit cxusb_module_exit(void)
2050{
2051 /* deregister this driver from the USB subsystem */
2052 usb_deregister(&cxusb_driver);
2053}
2054
2055module_init (cxusb_module_init);
2056module_exit (cxusb_module_exit);
2057 2038
2058MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 2039MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
2059MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); 2040MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
index 156cbfc9c79d..206999476f02 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -832,27 +832,7 @@ static struct usb_driver dib0700_driver = {
832 .id_table = dib0700_usb_id_table, 832 .id_table = dib0700_usb_id_table,
833}; 833};
834 834
835/* module stuff */ 835module_usb_driver(dib0700_driver);
836static int __init dib0700_module_init(void)
837{
838 int result;
839 info("loaded with support for %d different device-types", dib0700_device_count);
840 if ((result = usb_register(&dib0700_driver))) {
841 err("usb_register failed. Error number %d",result);
842 return result;
843 }
844
845 return 0;
846}
847
848static void __exit dib0700_module_exit(void)
849{
850 /* deregister this driver from the USB subsystem */
851 usb_deregister(&dib0700_driver);
852}
853
854module_init (dib0700_module_init);
855module_exit (dib0700_module_exit);
856 836
857MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>"); 837MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>");
858MODULE_DESCRIPTION("Driver for devices based on DiBcom DiB0700 - USB bridge"); 838MODULE_DESCRIPTION("Driver for devices based on DiBcom DiB0700 - USB bridge");
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c
index 7270791f8340..a4ac37e0e98b 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-mb.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c
@@ -463,26 +463,7 @@ static struct usb_driver dibusb_driver = {
463 .id_table = dibusb_dib3000mb_table, 463 .id_table = dibusb_dib3000mb_table,
464}; 464};
465 465
466/* module stuff */ 466module_usb_driver(dibusb_driver);
467static int __init dibusb_module_init(void)
468{
469 int result;
470 if ((result = usb_register(&dibusb_driver))) {
471 err("usb_register failed. Error number %d",result);
472 return result;
473 }
474
475 return 0;
476}
477
478static void __exit dibusb_module_exit(void)
479{
480 /* deregister this driver from the USB subsystem */
481 usb_deregister(&dibusb_driver);
482}
483
484module_init (dibusb_module_init);
485module_exit (dibusb_module_exit);
486 467
487MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 468MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
488MODULE_DESCRIPTION("Driver for DiBcom USB DVB-T devices (DiB3000M-B based)"); 469MODULE_DESCRIPTION("Driver for DiBcom USB DVB-T devices (DiB3000M-B based)");
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c
index 9c165e2569d4..9d1a59d09c52 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-mc.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c
@@ -141,26 +141,7 @@ static struct usb_driver dibusb_mc_driver = {
141 .id_table = dibusb_dib3000mc_table, 141 .id_table = dibusb_dib3000mc_table,
142}; 142};
143 143
144/* module stuff */ 144module_usb_driver(dibusb_mc_driver);
145static int __init dibusb_mc_module_init(void)
146{
147 int result;
148 if ((result = usb_register(&dibusb_mc_driver))) {
149 err("usb_register failed. Error number %d",result);
150 return result;
151 }
152
153 return 0;
154}
155
156static void __exit dibusb_mc_module_exit(void)
157{
158 /* deregister this driver from the USB subsystem */
159 usb_deregister(&dibusb_mc_driver);
160}
161
162module_init (dibusb_mc_module_init);
163module_exit (dibusb_mc_module_exit);
164 145
165MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 146MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
166MODULE_DESCRIPTION("Driver for DiBcom USB2.0 DVB-T (DiB3000M-C/P based) devices"); 147MODULE_DESCRIPTION("Driver for DiBcom USB2.0 DVB-T (DiB3000M-C/P based) devices");
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c
index f7184111aa64..0a9a79820f26 100644
--- a/drivers/media/dvb/dvb-usb/digitv.c
+++ b/drivers/media/dvb/dvb-usb/digitv.c
@@ -346,26 +346,7 @@ static struct usb_driver digitv_driver = {
346 .id_table = digitv_table, 346 .id_table = digitv_table,
347}; 347};
348 348
349/* module stuff */ 349module_usb_driver(digitv_driver);
350static int __init digitv_module_init(void)
351{
352 int result;
353 if ((result = usb_register(&digitv_driver))) {
354 err("usb_register failed. Error number %d",result);
355 return result;
356 }
357
358 return 0;
359}
360
361static void __exit digitv_module_exit(void)
362{
363 /* deregister this driver from the USB subsystem */
364 usb_deregister(&digitv_driver);
365}
366
367module_init (digitv_module_init);
368module_exit (digitv_module_exit);
369 350
370MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 351MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
371MODULE_DESCRIPTION("Driver for Nebula Electronics uDigiTV DVB-T USB2.0"); 352MODULE_DESCRIPTION("Driver for Nebula Electronics uDigiTV DVB-T USB2.0");
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c
index 106dfd55ff9c..66f205c112b2 100644
--- a/drivers/media/dvb/dvb-usb/dtt200u.c
+++ b/drivers/media/dvb/dvb-usb/dtt200u.c
@@ -360,26 +360,7 @@ static struct usb_driver dtt200u_usb_driver = {
360 .id_table = dtt200u_usb_table, 360 .id_table = dtt200u_usb_table,
361}; 361};
362 362
363/* module stuff */ 363module_usb_driver(dtt200u_usb_driver);
364static int __init dtt200u_usb_module_init(void)
365{
366 int result;
367 if ((result = usb_register(&dtt200u_usb_driver))) {
368 err("usb_register failed. (%d)",result);
369 return result;
370 }
371
372 return 0;
373}
374
375static void __exit dtt200u_usb_module_exit(void)
376{
377 /* deregister this driver from the USB subsystem */
378 usb_deregister(&dtt200u_usb_driver);
379}
380
381module_init(dtt200u_usb_module_init);
382module_exit(dtt200u_usb_module_exit);
383 364
384MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 365MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
385MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon/Club3D/Miglia DVB-T USB2.0 devices"); 366MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon/Club3D/Miglia DVB-T USB2.0 devices");
diff --git a/drivers/media/dvb/dvb-usb/dtv5100.c b/drivers/media/dvb/dvb-usb/dtv5100.c
index 7373132163d2..3d11df41cac0 100644
--- a/drivers/media/dvb/dvb-usb/dtv5100.c
+++ b/drivers/media/dvb/dvb-usb/dtv5100.c
@@ -217,26 +217,7 @@ static struct usb_driver dtv5100_driver = {
217 .id_table = dtv5100_table, 217 .id_table = dtv5100_table,
218}; 218};
219 219
220/* module stuff */ 220module_usb_driver(dtv5100_driver);
221static int __init dtv5100_module_init(void)
222{
223 int ret;
224
225 ret = usb_register(&dtv5100_driver);
226 if (ret)
227 err("usb_register failed. Error number %d", ret);
228
229 return ret;
230}
231
232static void __exit dtv5100_module_exit(void)
233{
234 /* deregister this driver from the USB subsystem */
235 usb_deregister(&dtv5100_driver);
236}
237
238module_init(dtv5100_module_init);
239module_exit(dtv5100_module_exit);
240 221
241MODULE_AUTHOR(DRIVER_AUTHOR); 222MODULE_AUTHOR(DRIVER_AUTHOR);
242MODULE_DESCRIPTION(DRIVER_DESC); 223MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c
index f103ec1fe82e..ff941d20e6b7 100644
--- a/drivers/media/dvb/dvb-usb/dw2102.c
+++ b/drivers/media/dvb/dvb-usb/dw2102.c
@@ -1928,22 +1928,7 @@ static struct usb_driver dw2102_driver = {
1928 .id_table = dw2102_table, 1928 .id_table = dw2102_table,
1929}; 1929};
1930 1930
1931static int __init dw2102_module_init(void) 1931module_usb_driver(dw2102_driver);
1932{
1933 int ret = usb_register(&dw2102_driver);
1934 if (ret)
1935 err("usb_register failed. Error number %d", ret);
1936
1937 return ret;
1938}
1939
1940static void __exit dw2102_module_exit(void)
1941{
1942 usb_deregister(&dw2102_driver);
1943}
1944
1945module_init(dw2102_module_init);
1946module_exit(dw2102_module_exit);
1947 1932
1948MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by"); 1933MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
1949MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104," 1934MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104,"
diff --git a/drivers/media/dvb/dvb-usb/ec168.c b/drivers/media/dvb/dvb-usb/ec168.c
index 78442fe4aa5e..b4989ba8897d 100644
--- a/drivers/media/dvb/dvb-usb/ec168.c
+++ b/drivers/media/dvb/dvb-usb/ec168.c
@@ -428,27 +428,7 @@ static struct usb_driver ec168_driver = {
428 .id_table = ec168_id, 428 .id_table = ec168_id,
429}; 429};
430 430
431/* module stuff */ 431module_usb_driver(ec168_driver);
432static int __init ec168_module_init(void)
433{
434 int ret;
435 deb_info("%s:\n", __func__);
436 ret = usb_register(&ec168_driver);
437 if (ret)
438 err("module init failed:%d", ret);
439
440 return ret;
441}
442
443static void __exit ec168_module_exit(void)
444{
445 deb_info("%s:\n", __func__);
446 /* deregister this driver from the USB subsystem */
447 usb_deregister(&ec168_driver);
448}
449
450module_init(ec168_module_init);
451module_exit(ec168_module_exit);
452 432
453MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 433MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
454MODULE_DESCRIPTION("E3C EC168 DVB-T USB2.0 driver"); 434MODULE_DESCRIPTION("E3C EC168 DVB-T USB2.0 driver");
diff --git a/drivers/media/dvb/dvb-usb/friio.c b/drivers/media/dvb/dvb-usb/friio.c
index b092dc2137cd..474a17e4db0c 100644
--- a/drivers/media/dvb/dvb-usb/friio.c
+++ b/drivers/media/dvb/dvb-usb/friio.c
@@ -514,28 +514,7 @@ static struct usb_driver friio_driver = {
514 .id_table = friio_table, 514 .id_table = friio_table,
515}; 515};
516 516
517 517module_usb_driver(friio_driver);
518/* module stuff */
519static int __init friio_module_init(void)
520{
521 int ret;
522
523 ret = usb_register(&friio_driver);
524 if (ret)
525 err("usb_register failed. Error number %d", ret);
526
527 return ret;
528}
529
530
531static void __exit friio_module_exit(void)
532{
533 /* deregister this driver from the USB subsystem */
534 usb_deregister(&friio_driver);
535}
536
537module_init(friio_module_init);
538module_exit(friio_module_exit);
539 518
540MODULE_AUTHOR("Akihiro Tsukada <tskd2@yahoo.co.jp>"); 519MODULE_AUTHOR("Akihiro Tsukada <tskd2@yahoo.co.jp>");
541MODULE_DESCRIPTION("Driver for Friio ISDB-T USB2.0 Receiver"); 520MODULE_DESCRIPTION("Driver for Friio ISDB-T USB2.0 Receiver");
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index 63681df244c4..c1f5582e1cdf 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -209,26 +209,7 @@ static struct usb_driver gl861_driver = {
209 .id_table = gl861_table, 209 .id_table = gl861_table,
210}; 210};
211 211
212/* module stuff */ 212module_usb_driver(gl861_driver);
213static int __init gl861_module_init(void)
214{
215 int ret;
216
217 ret = usb_register(&gl861_driver);
218 if (ret)
219 err("usb_register failed. Error number %d", ret);
220
221 return ret;
222}
223
224static void __exit gl861_module_exit(void)
225{
226 /* deregister this driver from the USB subsystem */
227 usb_deregister(&gl861_driver);
228}
229
230module_init(gl861_module_init);
231module_exit(gl861_module_exit);
232 213
233MODULE_AUTHOR("Carl Lundqvist <comabug@gmail.com>"); 214MODULE_AUTHOR("Carl Lundqvist <comabug@gmail.com>");
234MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / GL861"); 215MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / GL861");
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c
index 5f71284703d0..5d0384dd45b5 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.c
+++ b/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -320,26 +320,7 @@ static struct usb_driver gp8psk_usb_driver = {
320 .id_table = gp8psk_usb_table, 320 .id_table = gp8psk_usb_table,
321}; 321};
322 322
323/* module stuff */ 323module_usb_driver(gp8psk_usb_driver);
324static int __init gp8psk_usb_module_init(void)
325{
326 int result;
327 if ((result = usb_register(&gp8psk_usb_driver))) {
328 err("usb_register failed. (%d)",result);
329 return result;
330 }
331
332 return 0;
333}
334
335static void __exit gp8psk_usb_module_exit(void)
336{
337 /* deregister this driver from the USB subsystem */
338 usb_deregister(&gp8psk_usb_driver);
339}
340
341module_init(gp8psk_usb_module_init);
342module_exit(gp8psk_usb_module_exit);
343 324
344MODULE_AUTHOR("Alan Nisota <alannisota@gamil.com>"); 325MODULE_AUTHOR("Alan Nisota <alannisota@gamil.com>");
345MODULE_DESCRIPTION("Driver for Genpix DVB-S"); 326MODULE_DESCRIPTION("Driver for Genpix DVB-S");
diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c
index c46226187143..67094b879bb4 100644
--- a/drivers/media/dvb/dvb-usb/it913x.c
+++ b/drivers/media/dvb/dvb-usb/it913x.c
@@ -675,26 +675,7 @@ static struct usb_driver it913x_driver = {
675 .id_table = it913x_table, 675 .id_table = it913x_table,
676}; 676};
677 677
678/* module stuff */ 678module_usb_driver(it913x_driver);
679static int __init it913x_module_init(void)
680{
681 int result = usb_register(&it913x_driver);
682 if (result) {
683 err("usb_register failed. Error number %d", result);
684 return result;
685 }
686
687 return 0;
688}
689
690static void __exit it913x_module_exit(void)
691{
692 /* deregister this driver from the USB subsystem */
693 usb_deregister(&it913x_driver);
694}
695
696module_init(it913x_module_init);
697module_exit(it913x_module_exit);
698 679
699MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); 680MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
700MODULE_DESCRIPTION("it913x USB 2 Driver"); 681MODULE_DESCRIPTION("it913x USB 2 Driver");
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c
index b9228240f5ce..1a876a65ed56 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -1289,26 +1289,7 @@ static struct usb_driver lme2510_driver = {
1289 .id_table = lme2510_table, 1289 .id_table = lme2510_table,
1290}; 1290};
1291 1291
1292/* module stuff */ 1292module_usb_driver(lme2510_driver);
1293static int __init lme2510_module_init(void)
1294{
1295 int result = usb_register(&lme2510_driver);
1296 if (result) {
1297 err("usb_register failed. Error number %d", result);
1298 return result;
1299 }
1300
1301 return 0;
1302}
1303
1304static void __exit lme2510_module_exit(void)
1305{
1306 /* deregister this driver from the USB subsystem */
1307 usb_deregister(&lme2510_driver);
1308}
1309
1310module_init(lme2510_module_init);
1311module_exit(lme2510_module_exit);
1312 1293
1313MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); 1294MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
1314MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); 1295MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0");
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index a1e1287c949e..288af29a8bb7 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -1086,27 +1086,7 @@ static struct usb_driver m920x_driver = {
1086 .id_table = m920x_table, 1086 .id_table = m920x_table,
1087}; 1087};
1088 1088
1089/* module stuff */ 1089module_usb_driver(m920x_driver);
1090static int __init m920x_module_init(void)
1091{
1092 int ret;
1093
1094 if ((ret = usb_register(&m920x_driver))) {
1095 err("usb_register failed. Error number %d", ret);
1096 return ret;
1097 }
1098
1099 return 0;
1100}
1101
1102static void __exit m920x_module_exit(void)
1103{
1104 /* deregister this driver from the USB subsystem */
1105 usb_deregister(&m920x_driver);
1106}
1107
1108module_init (m920x_module_init);
1109module_exit (m920x_module_exit);
1110 1090
1111MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>"); 1091MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
1112MODULE_DESCRIPTION("DVB Driver for ULI M920x"); 1092MODULE_DESCRIPTION("DVB Driver for ULI M920x");
diff --git a/drivers/media/dvb/dvb-usb/mxl111sf.c b/drivers/media/dvb/dvb-usb/mxl111sf.c
index b5c98da5d9e2..825a8b242e09 100644
--- a/drivers/media/dvb/dvb-usb/mxl111sf.c
+++ b/drivers/media/dvb/dvb-usb/mxl111sf.c
@@ -1055,24 +1055,7 @@ static struct usb_driver mxl111sf_driver = {
1055 .id_table = mxl111sf_table, 1055 .id_table = mxl111sf_table,
1056}; 1056};
1057 1057
1058static int __init mxl111sf_module_init(void) 1058module_usb_driver(mxl111sf_driver);
1059{
1060 int result = usb_register(&mxl111sf_driver);
1061 if (result) {
1062 err("usb_register failed. Error number %d", result);
1063 return result;
1064 }
1065
1066 return 0;
1067}
1068
1069static void __exit mxl111sf_module_exit(void)
1070{
1071 usb_deregister(&mxl111sf_driver);
1072}
1073
1074module_init(mxl111sf_module_init);
1075module_exit(mxl111sf_module_exit);
1076 1059
1077MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>"); 1060MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>");
1078MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF"); 1061MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF");
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c
index 21384da6570e..6c55384e2fca 100644
--- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c
+++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c
@@ -225,26 +225,7 @@ static struct usb_driver nova_t_driver = {
225 .id_table = nova_t_table, 225 .id_table = nova_t_table,
226}; 226};
227 227
228/* module stuff */ 228module_usb_driver(nova_t_driver);
229static int __init nova_t_module_init(void)
230{
231 int result;
232 if ((result = usb_register(&nova_t_driver))) {
233 err("usb_register failed. Error number %d",result);
234 return result;
235 }
236
237 return 0;
238}
239
240static void __exit nova_t_module_exit(void)
241{
242 /* deregister this driver from the USB subsystem */
243 usb_deregister(&nova_t_driver);
244}
245
246module_init (nova_t_module_init);
247module_exit (nova_t_module_exit);
248 229
249MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 230MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
250MODULE_DESCRIPTION("Hauppauge WinTV-NOVA-T usb2"); 231MODULE_DESCRIPTION("Hauppauge WinTV-NOVA-T usb2");
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c
index 98fd9a6092b7..c8a95042dfbc 100644
--- a/drivers/media/dvb/dvb-usb/opera1.c
+++ b/drivers/media/dvb/dvb-usb/opera1.c
@@ -574,22 +574,7 @@ static struct usb_driver opera1_driver = {
574 .id_table = opera1_table, 574 .id_table = opera1_table,
575}; 575};
576 576
577static int __init opera1_module_init(void) 577module_usb_driver(opera1_driver);
578{
579 int result = 0;
580 if ((result = usb_register(&opera1_driver))) {
581 err("usb_register failed. Error number %d", result);
582 }
583 return result;
584}
585
586static void __exit opera1_module_exit(void)
587{
588 usb_deregister(&opera1_driver);
589}
590
591module_init(opera1_module_init);
592module_exit(opera1_module_exit);
593 578
594MODULE_AUTHOR("Mario Hlawitschka (c) dh1pa@amsat.org"); 579MODULE_AUTHOR("Mario Hlawitschka (c) dh1pa@amsat.org");
595MODULE_AUTHOR("Marco Gittler (c) g.marco@freenet.de"); 580MODULE_AUTHOR("Marco Gittler (c) g.marco@freenet.de");
diff --git a/drivers/media/dvb/dvb-usb/pctv452e.c b/drivers/media/dvb/dvb-usb/pctv452e.c
index f9aec5cb6e77..f526eb05cc7a 100644
--- a/drivers/media/dvb/dvb-usb/pctv452e.c
+++ b/drivers/media/dvb/dvb-usb/pctv452e.c
@@ -1055,22 +1055,7 @@ static struct usb_driver pctv452e_usb_driver = {
1055 .id_table = pctv452e_usb_table, 1055 .id_table = pctv452e_usb_table,
1056}; 1056};
1057 1057
1058static int __init pctv452e_usb_init(void) 1058module_usb_driver(pctv452e_usb_driver);
1059{
1060 int ret = usb_register(&pctv452e_usb_driver);
1061 if (ret)
1062 err("%s: usb_register failed! Error %d", __FILE__, ret);
1063
1064 return ret;
1065}
1066
1067static void __exit pctv452e_usb_exit(void)
1068{
1069 usb_deregister(&pctv452e_usb_driver);
1070}
1071
1072module_init(pctv452e_usb_init);
1073module_exit(pctv452e_usb_exit);
1074 1059
1075MODULE_AUTHOR("Dominik Kuhlen <dkuhlen@gmx.net>"); 1060MODULE_AUTHOR("Dominik Kuhlen <dkuhlen@gmx.net>");
1076MODULE_AUTHOR("Andre Weidemann <Andre.Weidemann@web.de>"); 1061MODULE_AUTHOR("Andre Weidemann <Andre.Weidemann@web.de>");
diff --git a/drivers/media/dvb/dvb-usb/technisat-usb2.c b/drivers/media/dvb/dvb-usb/technisat-usb2.c
index 0998fe961950..acefaa89cc53 100644
--- a/drivers/media/dvb/dvb-usb/technisat-usb2.c
+++ b/drivers/media/dvb/dvb-usb/technisat-usb2.c
@@ -781,25 +781,7 @@ static struct usb_driver technisat_usb2_driver = {
781 .id_table = technisat_usb2_id_table, 781 .id_table = technisat_usb2_id_table,
782}; 782};
783 783
784/* module stuff */ 784module_usb_driver(technisat_usb2_driver);
785static int __init technisat_usb2_module_init(void)
786{
787 int result = usb_register(&technisat_usb2_driver);
788 if (result) {
789 err("usb_register failed. Code %d", result);
790 return result;
791 }
792
793 return 0;
794}
795
796static void __exit technisat_usb2_module_exit(void)
797{
798 usb_deregister(&technisat_usb2_driver);
799}
800
801module_init(technisat_usb2_module_init);
802module_exit(technisat_usb2_module_exit);
803 785
804MODULE_AUTHOR("Patrick Boettcher <pboettcher@kernellabs.com>"); 786MODULE_AUTHOR("Patrick Boettcher <pboettcher@kernellabs.com>");
805MODULE_DESCRIPTION("Driver for Technisat DVB-S/S2 USB 2.0 device"); 787MODULE_DESCRIPTION("Driver for Technisat DVB-S/S2 USB 2.0 device");
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c
index ea4eab8b3965..56acf8e55d50 100644
--- a/drivers/media/dvb/dvb-usb/ttusb2.c
+++ b/drivers/media/dvb/dvb-usb/ttusb2.c
@@ -799,26 +799,7 @@ static struct usb_driver ttusb2_driver = {
799 .id_table = ttusb2_table, 799 .id_table = ttusb2_table,
800}; 800};
801 801
802/* module stuff */ 802module_usb_driver(ttusb2_driver);
803static int __init ttusb2_module_init(void)
804{
805 int result;
806 if ((result = usb_register(&ttusb2_driver))) {
807 err("usb_register failed. Error number %d",result);
808 return result;
809 }
810
811 return 0;
812}
813
814static void __exit ttusb2_module_exit(void)
815{
816 /* deregister this driver from the USB subsystem */
817 usb_deregister(&ttusb2_driver);
818}
819
820module_init (ttusb2_module_init);
821module_exit (ttusb2_module_exit);
822 803
823MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 804MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
824MODULE_DESCRIPTION("Driver for Pinnacle PCTV 400e DVB-S USB2.0"); 805MODULE_DESCRIPTION("Driver for Pinnacle PCTV 400e DVB-S USB2.0");
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c
index 463673a5c2b2..9b042292e788 100644
--- a/drivers/media/dvb/dvb-usb/umt-010.c
+++ b/drivers/media/dvb/dvb-usb/umt-010.c
@@ -143,26 +143,7 @@ static struct usb_driver umt_driver = {
143 .id_table = umt_table, 143 .id_table = umt_table,
144}; 144};
145 145
146/* module stuff */ 146module_usb_driver(umt_driver);
147static int __init umt_module_init(void)
148{
149 int result;
150 if ((result = usb_register(&umt_driver))) {
151 err("usb_register failed. Error number %d",result);
152 return result;
153 }
154
155 return 0;
156}
157
158static void __exit umt_module_exit(void)
159{
160 /* deregister this driver from the USB subsystem */
161 usb_deregister(&umt_driver);
162}
163
164module_init (umt_module_init);
165module_exit (umt_module_exit);
166 147
167MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 148MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
168MODULE_DESCRIPTION("Driver for HanfTek UMT 010 USB2.0 DVB-T device"); 149MODULE_DESCRIPTION("Driver for HanfTek UMT 010 USB2.0 DVB-T device");
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c
index 45e31f224814..07c673a6e764 100644
--- a/drivers/media/dvb/dvb-usb/vp702x.c
+++ b/drivers/media/dvb/dvb-usb/vp702x.c
@@ -436,26 +436,7 @@ static struct usb_driver vp702x_usb_driver = {
436 .id_table = vp702x_usb_table, 436 .id_table = vp702x_usb_table,
437}; 437};
438 438
439/* module stuff */ 439module_usb_driver(vp702x_usb_driver);
440static int __init vp702x_usb_module_init(void)
441{
442 int result;
443 if ((result = usb_register(&vp702x_usb_driver))) {
444 err("usb_register failed. (%d)",result);
445 return result;
446 }
447
448 return 0;
449}
450
451static void __exit vp702x_usb_module_exit(void)
452{
453 /* deregister this driver from the USB subsystem */
454 usb_deregister(&vp702x_usb_driver);
455}
456
457module_init(vp702x_usb_module_init);
458module_exit(vp702x_usb_module_exit);
459 440
460MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 441MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
461MODULE_DESCRIPTION("Driver for Twinhan StarBox DVB-S USB2.0 and clones"); 442MODULE_DESCRIPTION("Driver for Twinhan StarBox DVB-S USB2.0 and clones");
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index 90873af5682e..d750724132ee 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -294,26 +294,7 @@ static struct usb_driver vp7045_usb_driver = {
294 .id_table = vp7045_usb_table, 294 .id_table = vp7045_usb_table,
295}; 295};
296 296
297/* module stuff */ 297module_usb_driver(vp7045_usb_driver);
298static int __init vp7045_usb_module_init(void)
299{
300 int result;
301 if ((result = usb_register(&vp7045_usb_driver))) {
302 err("usb_register failed. (%d)",result);
303 return result;
304 }
305
306 return 0;
307}
308
309static void __exit vp7045_usb_module_exit(void)
310{
311 /* deregister this driver from the USB subsystem */
312 usb_deregister(&vp7045_usb_driver);
313}
314
315module_init(vp7045_usb_module_init);
316module_exit(vp7045_usb_module_exit);
317 298
318MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 299MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
319MODULE_DESCRIPTION("Driver for Twinhan MagicBox/Alpha and DNTV tinyUSB2 DVB-T USB2.0"); 300MODULE_DESCRIPTION("Driver for Twinhan MagicBox/Alpha and DNTV tinyUSB2 DVB-T USB2.0");
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
index 51c7121b321a..b1fe5137df09 100644
--- a/drivers/media/dvb/siano/smsusb.c
+++ b/drivers/media/dvb/siano/smsusb.c
@@ -557,26 +557,7 @@ static struct usb_driver smsusb_driver = {
557 .resume = smsusb_resume, 557 .resume = smsusb_resume,
558}; 558};
559 559
560static int __init smsusb_module_init(void) 560module_usb_driver(smsusb_driver);
561{
562 int rc = usb_register(&smsusb_driver);
563 if (rc)
564 sms_err("usb_register failed. Error number %d", rc);
565
566 sms_debug("");
567
568 return rc;
569}
570
571static void __exit smsusb_module_exit(void)
572{
573 /* Regular USB Cleanup */
574 usb_deregister(&smsusb_driver);
575 sms_info("end");
576}
577
578module_init(smsusb_module_init);
579module_exit(smsusb_module_exit);
580 561
581MODULE_DESCRIPTION("Driver for the Siano SMS1xxx USB dongle"); 562MODULE_DESCRIPTION("Driver for the Siano SMS1xxx USB dongle");
582MODULE_AUTHOR("Siano Mobile Silicon, INC. (uris@siano-ms.com)"); 563MODULE_AUTHOR("Siano Mobile Silicon, INC. (uris@siano-ms.com)");
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 420bb42d5233..e90192fdde11 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -1794,26 +1794,7 @@ static struct usb_driver ttusb_driver = {
1794 .id_table = ttusb_table, 1794 .id_table = ttusb_table,
1795}; 1795};
1796 1796
1797static int __init ttusb_init(void) 1797module_usb_driver(ttusb_driver);
1798{
1799 int err;
1800
1801 if ((err = usb_register(&ttusb_driver)) < 0) {
1802 printk("%s: usb_register failed! Error number %d",
1803 __FILE__, err);
1804 return err;
1805 }
1806
1807 return 0;
1808}
1809
1810static void __exit ttusb_exit(void)
1811{
1812 usb_deregister(&ttusb_driver);
1813}
1814
1815module_init(ttusb_init);
1816module_exit(ttusb_exit);
1817 1798
1818MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>"); 1799MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>");
1819MODULE_DESCRIPTION("TTUSB DVB Driver"); 1800MODULE_DESCRIPTION("TTUSB DVB Driver");
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index f893bffa08a3..504c81230339 100644
--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -1756,26 +1756,7 @@ static struct usb_driver ttusb_dec_driver = {
1756 .id_table = ttusb_dec_table, 1756 .id_table = ttusb_dec_table,
1757}; 1757};
1758 1758
1759static int __init ttusb_dec_init(void) 1759module_usb_driver(ttusb_dec_driver);
1760{
1761 int result;
1762
1763 if ((result = usb_register(&ttusb_dec_driver)) < 0) {
1764 printk("%s: initialisation failed: error %d.\n", __func__,
1765 result);
1766 return result;
1767 }
1768
1769 return 0;
1770}
1771
1772static void __exit ttusb_dec_exit(void)
1773{
1774 usb_deregister(&ttusb_dec_driver);
1775}
1776
1777module_init(ttusb_dec_init);
1778module_exit(ttusb_dec_exit);
1779 1760
1780MODULE_AUTHOR("Alex Woods <linux-dvb@giblets.org>"); 1761MODULE_AUTHOR("Alex Woods <linux-dvb@giblets.org>");
1781MODULE_DESCRIPTION(DRIVER_NAME); 1762MODULE_DESCRIPTION(DRIVER_NAME);
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c
index 25e58cbf35f0..f36905b63645 100644
--- a/drivers/media/radio/dsbr100.c
+++ b/drivers/media/radio/dsbr100.c
@@ -624,21 +624,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
624 return 0; 624 return 0;
625} 625}
626 626
627static int __init dsbr100_init(void) 627module_usb_driver(usb_dsbr100_driver);
628{
629 int retval = usb_register(&usb_dsbr100_driver);
630 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
631 DRIVER_DESC "\n");
632 return retval;
633}
634
635static void __exit dsbr100_exit(void)
636{
637 usb_deregister(&usb_dsbr100_driver);
638}
639
640module_init (dsbr100_init);
641module_exit (dsbr100_exit);
642 628
643MODULE_AUTHOR( DRIVER_AUTHOR ); 629MODULE_AUTHOR( DRIVER_AUTHOR );
644MODULE_DESCRIPTION( DRIVER_DESC ); 630MODULE_DESCRIPTION( DRIVER_DESC );
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index 1742bd8110bd..a860a72a58ec 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -659,25 +659,4 @@ err:
659 return retval; 659 return retval;
660} 660}
661 661
662static int __init amradio_init(void) 662module_usb_driver(usb_amradio_driver);
663{
664 int retval = usb_register(&usb_amradio_driver);
665
666 pr_info(KBUILD_MODNAME
667 ": version " DRIVER_VERSION " " DRIVER_DESC "\n");
668
669 if (retval)
670 pr_err(KBUILD_MODNAME
671 ": usb_register failed. Error number %d\n", retval);
672
673 return retval;
674}
675
676static void __exit amradio_exit(void)
677{
678 usb_deregister(&usb_amradio_driver);
679}
680
681module_init(amradio_init);
682module_exit(amradio_exit);
683
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index a6ad707fae96..b7debb67932a 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -861,33 +861,7 @@ static struct usb_driver si470x_usb_driver = {
861 .supports_autosuspend = 1, 861 .supports_autosuspend = 1,
862}; 862};
863 863
864 864module_usb_driver(si470x_usb_driver);
865
866/**************************************************************************
867 * Module Interface
868 **************************************************************************/
869
870/*
871 * si470x_module_init - module init
872 */
873static int __init si470x_module_init(void)
874{
875 printk(KERN_INFO DRIVER_DESC ", Version " DRIVER_VERSION "\n");
876 return usb_register(&si470x_usb_driver);
877}
878
879
880/*
881 * si470x_module_exit - module exit
882 */
883static void __exit si470x_module_exit(void)
884{
885 usb_deregister(&si470x_usb_driver);
886}
887
888
889module_init(si470x_module_init);
890module_exit(si470x_module_exit);
891 865
892MODULE_LICENSE("GPL"); 866MODULE_LICENSE("GPL");
893MODULE_AUTHOR(DRIVER_AUTHOR); 867MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index 01bb8daf4b09..baf907b3ce76 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -899,38 +899,7 @@ static void ati_remote_disconnect(struct usb_interface *interface)
899 kfree(ati_remote); 899 kfree(ati_remote);
900} 900}
901 901
902/* 902module_usb_driver(ati_remote_driver);
903 * ati_remote_init
904 */
905static int __init ati_remote_init(void)
906{
907 int result;
908
909 result = usb_register(&ati_remote_driver);
910 if (result)
911 printk(KERN_ERR KBUILD_MODNAME
912 ": usb_register error #%d\n", result);
913 else
914 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
915 DRIVER_DESC "\n");
916
917 return result;
918}
919
920/*
921 * ati_remote_exit
922 */
923static void __exit ati_remote_exit(void)
924{
925 usb_deregister(&ati_remote_driver);
926}
927
928/*
929 * module specification
930 */
931
932module_init(ati_remote_init);
933module_exit(ati_remote_exit);
934 903
935MODULE_AUTHOR(DRIVER_AUTHOR); 904MODULE_AUTHOR(DRIVER_AUTHOR);
936MODULE_DESCRIPTION(DRIVER_DESC); 905MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 6ed96465137a..3aeb29a7ce11 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -2458,23 +2458,4 @@ static int imon_resume(struct usb_interface *intf)
2458 return rc; 2458 return rc;
2459} 2459}
2460 2460
2461static int __init imon_init(void) 2461module_usb_driver(imon_driver);
2462{
2463 int rc;
2464
2465 rc = usb_register(&imon_driver);
2466 if (rc) {
2467 pr_err("usb register failed(%d)\n", rc);
2468 rc = -ENODEV;
2469 }
2470
2471 return rc;
2472}
2473
2474static void __exit imon_exit(void)
2475{
2476 usb_deregister(&imon_driver);
2477}
2478
2479module_init(imon_init);
2480module_exit(imon_exit);
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 60d3c1e09712..20bb12d6fbbe 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1448,25 +1448,7 @@ static struct usb_driver mceusb_dev_driver = {
1448 .id_table = mceusb_dev_table 1448 .id_table = mceusb_dev_table
1449}; 1449};
1450 1450
1451static int __init mceusb_dev_init(void) 1451module_usb_driver(mceusb_dev_driver);
1452{
1453 int ret;
1454
1455 ret = usb_register(&mceusb_dev_driver);
1456 if (ret < 0)
1457 printk(KERN_ERR DRIVER_NAME
1458 ": usb register failed, result = %d\n", ret);
1459
1460 return ret;
1461}
1462
1463static void __exit mceusb_dev_exit(void)
1464{
1465 usb_deregister(&mceusb_dev_driver);
1466}
1467
1468module_init(mceusb_dev_init);
1469module_exit(mceusb_dev_exit);
1470 1452
1471MODULE_DESCRIPTION(DRIVER_DESC); 1453MODULE_DESCRIPTION(DRIVER_DESC);
1472MODULE_AUTHOR(DRIVER_AUTHOR); 1454MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 61287fcca61a..07322fb75eff 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -1300,25 +1300,7 @@ static struct usb_driver redrat3_dev_driver = {
1300 .id_table = redrat3_dev_table 1300 .id_table = redrat3_dev_table
1301}; 1301};
1302 1302
1303static int __init redrat3_dev_init(void) 1303module_usb_driver(redrat3_dev_driver);
1304{
1305 int ret;
1306
1307 ret = usb_register(&redrat3_dev_driver);
1308 if (ret < 0)
1309 pr_err(DRIVER_NAME
1310 ": usb register failed, result = %d\n", ret);
1311
1312 return ret;
1313}
1314
1315static void __exit redrat3_dev_exit(void)
1316{
1317 usb_deregister(&redrat3_dev_driver);
1318}
1319
1320module_init(redrat3_dev_init);
1321module_exit(redrat3_dev_exit);
1322 1304
1323MODULE_DESCRIPTION(DRIVER_DESC); 1305MODULE_DESCRIPTION(DRIVER_DESC);
1324MODULE_AUTHOR(DRIVER_AUTHOR); 1306MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index e435d94c0776..b1d29d09eeae 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -523,33 +523,7 @@ static int streamzap_resume(struct usb_interface *intf)
523 return 0; 523 return 0;
524} 524}
525 525
526/** 526module_usb_driver(streamzap_driver);
527 * streamzap_init
528 */
529static int __init streamzap_init(void)
530{
531 int ret;
532
533 /* register this driver with the USB subsystem */
534 ret = usb_register(&streamzap_driver);
535 if (ret < 0)
536 printk(KERN_ERR DRIVER_NAME ": usb register failed, "
537 "result = %d\n", ret);
538
539 return ret;
540}
541
542/**
543 * streamzap_exit
544 */
545static void __exit streamzap_exit(void)
546{
547 usb_deregister(&streamzap_driver);
548}
549
550
551module_init(streamzap_init);
552module_exit(streamzap_exit);
553 527
554MODULE_AUTHOR("Jarod Wilson <jarod@wilsonet.com>"); 528MODULE_AUTHOR("Jarod Wilson <jarod@wilsonet.com>");
555MODULE_DESCRIPTION(DRIVER_DESC); 529MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c
index 53dae2a8272d..60b021e79864 100644
--- a/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -1385,26 +1385,4 @@ static struct usb_driver cx231xx_usb_driver = {
1385 .id_table = cx231xx_id_table, 1385 .id_table = cx231xx_id_table,
1386}; 1386};
1387 1387
1388static int __init cx231xx_module_init(void) 1388module_usb_driver(cx231xx_usb_driver);
1389{
1390 int result;
1391
1392 printk(KERN_INFO DRIVER_NAME " v4l2 driver loaded.\n");
1393
1394 /* register this driver with the USB subsystem */
1395 result = usb_register(&cx231xx_usb_driver);
1396 if (result)
1397 cx231xx_err(DRIVER_NAME
1398 " usb_register failed. Error number %d.\n", result);
1399
1400 return result;
1401}
1402
1403static void __exit cx231xx_module_exit(void)
1404{
1405 /* deregister this driver with the USB subsystem */
1406 usb_deregister(&cx231xx_usb_driver);
1407}
1408
1409module_init(cx231xx_module_init);
1410module_exit(cx231xx_module_exit);
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 9b747c266afa..93807dcf944e 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -3325,26 +3325,4 @@ static struct usb_driver em28xx_usb_driver = {
3325 .id_table = em28xx_id_table, 3325 .id_table = em28xx_id_table,
3326}; 3326};
3327 3327
3328static int __init em28xx_module_init(void) 3328module_usb_driver(em28xx_usb_driver);
3329{
3330 int result;
3331
3332 /* register this driver with the USB subsystem */
3333 result = usb_register(&em28xx_usb_driver);
3334 if (result)
3335 em28xx_err(DRIVER_NAME
3336 " usb_register failed. Error number %d.\n", result);
3337
3338 printk(KERN_INFO DRIVER_NAME " driver loaded\n");
3339
3340 return result;
3341}
3342
3343static void __exit em28xx_module_exit(void)
3344{
3345 /* deregister this driver with the USB subsystem */
3346 usb_deregister(&em28xx_usb_driver);
3347}
3348
3349module_init(em28xx_module_init);
3350module_exit(em28xx_module_exit);
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index d3777c86e1de..40f214ab924f 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -2680,27 +2680,4 @@ static struct usb_driver et61x251_usb_driver = {
2680 .disconnect = et61x251_usb_disconnect, 2680 .disconnect = et61x251_usb_disconnect,
2681}; 2681};
2682 2682
2683/*****************************************************************************/ 2683module_usb_driver(et61x251_usb_driver);
2684
2685static int __init et61x251_module_init(void)
2686{
2687 int err = 0;
2688
2689 KDBG(2, ET61X251_MODULE_NAME " v" ET61X251_MODULE_VERSION);
2690 KDBG(3, ET61X251_MODULE_AUTHOR);
2691
2692 if ((err = usb_register(&et61x251_usb_driver)))
2693 KDBG(1, "usb_register() failed");
2694
2695 return err;
2696}
2697
2698
2699static void __exit et61x251_module_exit(void)
2700{
2701 usb_deregister(&et61x251_usb_driver);
2702}
2703
2704
2705module_init(et61x251_module_init);
2706module_exit(et61x251_module_exit);
diff --git a/drivers/media/video/gspca/benq.c b/drivers/media/video/gspca/benq.c
index 6ae26160b81f..636627b57dc9 100644
--- a/drivers/media/video/gspca/benq.c
+++ b/drivers/media/video/gspca/benq.c
@@ -288,15 +288,4 @@ static struct usb_driver sd_driver = {
288#endif 288#endif
289}; 289};
290 290
291/* -- module insert / remove -- */ 291module_usb_driver(sd_driver);
292static int __init sd_mod_init(void)
293{
294 return usb_register(&sd_driver);
295}
296static void __exit sd_mod_exit(void)
297{
298 usb_deregister(&sd_driver);
299}
300
301module_init(sd_mod_init);
302module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index 4c56dbef6d92..ea17b5d94ea4 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -1067,15 +1067,4 @@ static struct usb_driver sd_driver = {
1067#endif 1067#endif
1068}; 1068};
1069 1069
1070/* -- module insert / remove -- */ 1070module_usb_driver(sd_driver);
1071static int __init sd_mod_init(void)
1072{
1073 return usb_register(&sd_driver);
1074}
1075static void __exit sd_mod_exit(void)
1076{
1077 usb_deregister(&sd_driver);
1078}
1079
1080module_init(sd_mod_init);
1081module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c
index f9b86b2484b0..8f33bbd091ad 100644
--- a/drivers/media/video/gspca/cpia1.c
+++ b/drivers/media/video/gspca/cpia1.c
@@ -2132,15 +2132,4 @@ static struct usb_driver sd_driver = {
2132#endif 2132#endif
2133}; 2133};
2134 2134
2135/* -- module insert / remove -- */ 2135module_usb_driver(sd_driver);
2136static int __init sd_mod_init(void)
2137{
2138 return usb_register(&sd_driver);
2139}
2140static void __exit sd_mod_exit(void)
2141{
2142 usb_deregister(&sd_driver);
2143}
2144
2145module_init(sd_mod_init);
2146module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c
index 0357d6d461d1..81a4adbd9f7c 100644
--- a/drivers/media/video/gspca/etoms.c
+++ b/drivers/media/video/gspca/etoms.c
@@ -895,16 +895,4 @@ static struct usb_driver sd_driver = {
895#endif 895#endif
896}; 896};
897 897
898/* -- module insert / remove -- */ 898module_usb_driver(sd_driver);
899static int __init sd_mod_init(void)
900{
901 return usb_register(&sd_driver);
902}
903
904static void __exit sd_mod_exit(void)
905{
906 usb_deregister(&sd_driver);
907}
908
909module_init(sd_mod_init);
910module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/finepix.c b/drivers/media/video/gspca/finepix.c
index ea48200fd3a0..0107513cd728 100644
--- a/drivers/media/video/gspca/finepix.c
+++ b/drivers/media/video/gspca/finepix.c
@@ -290,16 +290,4 @@ static struct usb_driver sd_driver = {
290#endif 290#endif
291}; 291};
292 292
293/* -- module insert / remove -- */ 293module_usb_driver(sd_driver);
294static int __init sd_mod_init(void)
295{
296 return usb_register(&sd_driver);
297}
298
299static void __exit sd_mod_exit(void)
300{
301 usb_deregister(&sd_driver);
302}
303
304module_init(sd_mod_init);
305module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/gl860/gl860.c b/drivers/media/video/gspca/gl860/gl860.c
index 2ced3b73994f..a8f54c20e585 100644
--- a/drivers/media/video/gspca/gl860/gl860.c
+++ b/drivers/media/video/gspca/gl860/gl860.c
@@ -524,22 +524,7 @@ static struct usb_driver sd_driver = {
524 524
525/*====================== Init and Exit module functions ====================*/ 525/*====================== Init and Exit module functions ====================*/
526 526
527static int __init sd_mod_init(void) 527module_usb_driver(sd_driver);
528{
529 PDEBUG(D_PROBE, "driver startup - version %s", DRIVER_VERSION);
530
531 if (usb_register(&sd_driver) < 0)
532 return -1;
533 return 0;
534}
535
536static void __exit sd_mod_exit(void)
537{
538 usb_deregister(&sd_driver);
539}
540
541module_init(sd_mod_init);
542module_exit(sd_mod_exit);
543 528
544/*==========================================================================*/ 529/*==========================================================================*/
545 530
diff --git a/drivers/media/video/gspca/jeilinj.c b/drivers/media/video/gspca/jeilinj.c
index 8e3dabe30077..5ab3f7e12760 100644
--- a/drivers/media/video/gspca/jeilinj.c
+++ b/drivers/media/video/gspca/jeilinj.c
@@ -582,16 +582,4 @@ static struct usb_driver sd_driver = {
582#endif 582#endif
583}; 583};
584 584
585/* -- module insert / remove -- */ 585module_usb_driver(sd_driver);
586static int __init sd_mod_init(void)
587{
588 return usb_register(&sd_driver);
589}
590
591static void __exit sd_mod_exit(void)
592{
593 usb_deregister(&sd_driver);
594}
595
596module_init(sd_mod_init);
597module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/kinect.c b/drivers/media/video/gspca/kinect.c
index 4fe51fda80f3..e8e8f2fe9166 100644
--- a/drivers/media/video/gspca/kinect.c
+++ b/drivers/media/video/gspca/kinect.c
@@ -413,16 +413,4 @@ static struct usb_driver sd_driver = {
413#endif 413#endif
414}; 414};
415 415
416/* -- module insert / remove -- */ 416module_usb_driver(sd_driver);
417static int __init sd_mod_init(void)
418{
419 return usb_register(&sd_driver);
420}
421
422static void __exit sd_mod_exit(void)
423{
424 usb_deregister(&sd_driver);
425}
426
427module_init(sd_mod_init);
428module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/konica.c b/drivers/media/video/gspca/konica.c
index f3f7fe0ec4b7..b1da7f4096c8 100644
--- a/drivers/media/video/gspca/konica.c
+++ b/drivers/media/video/gspca/konica.c
@@ -634,15 +634,4 @@ static struct usb_driver sd_driver = {
634#endif 634#endif
635}; 635};
636 636
637/* -- module insert / remove -- */ 637module_usb_driver(sd_driver);
638static int __init sd_mod_init(void)
639{
640 return usb_register(&sd_driver);
641}
642static void __exit sd_mod_exit(void)
643{
644 usb_deregister(&sd_driver);
645}
646
647module_init(sd_mod_init);
648module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c
index 67533e5582a6..9fe3816b2aa0 100644
--- a/drivers/media/video/gspca/m5602/m5602_core.c
+++ b/drivers/media/video/gspca/m5602/m5602_core.c
@@ -404,19 +404,7 @@ static struct usb_driver sd_driver = {
404 .disconnect = m5602_disconnect 404 .disconnect = m5602_disconnect
405}; 405};
406 406
407/* -- module insert / remove -- */ 407module_usb_driver(sd_driver);
408static int __init mod_m5602_init(void)
409{
410 return usb_register(&sd_driver);
411}
412
413static void __exit mod_m5602_exit(void)
414{
415 usb_deregister(&sd_driver);
416}
417
418module_init(mod_m5602_init);
419module_exit(mod_m5602_exit);
420 408
421MODULE_AUTHOR(DRIVER_AUTHOR); 409MODULE_AUTHOR(DRIVER_AUTHOR);
422MODULE_DESCRIPTION(DRIVER_DESC); 410MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index ef45fa575752..5c2ea05c46b4 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -517,15 +517,4 @@ static struct usb_driver sd_driver = {
517#endif 517#endif
518}; 518};
519 519
520/* -- module insert / remove -- */ 520module_usb_driver(sd_driver);
521static int __init sd_mod_init(void)
522{
523 return usb_register(&sd_driver);
524}
525static void __exit sd_mod_exit(void)
526{
527 usb_deregister(&sd_driver);
528}
529
530module_init(sd_mod_init);
531module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c
index 473e813b680e..d73e5bd3dbf7 100644
--- a/drivers/media/video/gspca/mr97310a.c
+++ b/drivers/media/video/gspca/mr97310a.c
@@ -1259,15 +1259,4 @@ static struct usb_driver sd_driver = {
1259#endif 1259#endif
1260}; 1260};
1261 1261
1262/* -- module insert / remove -- */ 1262module_usb_driver(sd_driver);
1263static int __init sd_mod_init(void)
1264{
1265 return usb_register(&sd_driver);
1266}
1267static void __exit sd_mod_exit(void)
1268{
1269 usb_deregister(&sd_driver);
1270}
1271
1272module_init(sd_mod_init);
1273module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/nw80x.c b/drivers/media/video/gspca/nw80x.c
index 7681814e594f..d4bec9321771 100644
--- a/drivers/media/video/gspca/nw80x.c
+++ b/drivers/media/video/gspca/nw80x.c
@@ -2118,18 +2118,7 @@ static struct usb_driver sd_driver = {
2118#endif 2118#endif
2119}; 2119};
2120 2120
2121/* -- module insert / remove -- */ 2121module_usb_driver(sd_driver);
2122static int __init sd_mod_init(void)
2123{
2124 return usb_register(&sd_driver);
2125}
2126static void __exit sd_mod_exit(void)
2127{
2128 usb_deregister(&sd_driver);
2129}
2130
2131module_init(sd_mod_init);
2132module_exit(sd_mod_exit);
2133 2122
2134module_param(webcam, int, 0644); 2123module_param(webcam, int, 0644);
2135MODULE_PARM_DESC(webcam, 2124MODULE_PARM_DESC(webcam,
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index 6a01b35a9478..08b8ce1dee18 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -5056,18 +5056,7 @@ static struct usb_driver sd_driver = {
5056#endif 5056#endif
5057}; 5057};
5058 5058
5059/* -- module insert / remove -- */ 5059module_usb_driver(sd_driver);
5060static int __init sd_mod_init(void)
5061{
5062 return usb_register(&sd_driver);
5063}
5064static void __exit sd_mod_exit(void)
5065{
5066 usb_deregister(&sd_driver);
5067}
5068
5069module_init(sd_mod_init);
5070module_exit(sd_mod_exit);
5071 5060
5072module_param(frame_rate, int, 0644); 5061module_param(frame_rate, int, 0644);
5073MODULE_PARM_DESC(frame_rate, "Frame rate (5, 10, 15, 20 or 30 fps)"); 5062MODULE_PARM_DESC(frame_rate, "Frame rate (5, 10, 15, 20 or 30 fps)");
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c
index 76907eced4a1..04753391de3e 100644
--- a/drivers/media/video/gspca/ov534.c
+++ b/drivers/media/video/gspca/ov534.c
@@ -1533,16 +1533,4 @@ static struct usb_driver sd_driver = {
1533#endif 1533#endif
1534}; 1534};
1535 1535
1536/* -- module insert / remove -- */ 1536module_usb_driver(sd_driver);
1537static int __init sd_mod_init(void)
1538{
1539 return usb_register(&sd_driver);
1540}
1541
1542static void __exit sd_mod_exit(void)
1543{
1544 usb_deregister(&sd_driver);
1545}
1546
1547module_init(sd_mod_init);
1548module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c
index b3b1ea60a841..f30060d50633 100644
--- a/drivers/media/video/gspca/ov534_9.c
+++ b/drivers/media/video/gspca/ov534_9.c
@@ -1432,16 +1432,4 @@ static struct usb_driver sd_driver = {
1432#endif 1432#endif
1433}; 1433};
1434 1434
1435/* -- module insert / remove -- */ 1435module_usb_driver(sd_driver);
1436static int __init sd_mod_init(void)
1437{
1438 return usb_register(&sd_driver);
1439}
1440
1441static void __exit sd_mod_exit(void)
1442{
1443 usb_deregister(&sd_driver);
1444}
1445
1446module_init(sd_mod_init);
1447module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c
index 1600df152fd6..ece8b1e82a13 100644
--- a/drivers/media/video/gspca/pac207.c
+++ b/drivers/media/video/gspca/pac207.c
@@ -569,15 +569,4 @@ static struct usb_driver sd_driver = {
569#endif 569#endif
570}; 570};
571 571
572/* -- module insert / remove -- */ 572module_usb_driver(sd_driver);
573static int __init sd_mod_init(void)
574{
575 return usb_register(&sd_driver);
576}
577static void __exit sd_mod_exit(void)
578{
579 usb_deregister(&sd_driver);
580}
581
582module_init(sd_mod_init);
583module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c
index 1c44f78ff9e2..2811195258c4 100644
--- a/drivers/media/video/gspca/pac7302.c
+++ b/drivers/media/video/gspca/pac7302.c
@@ -1220,15 +1220,4 @@ static struct usb_driver sd_driver = {
1220#endif 1220#endif
1221}; 1221};
1222 1222
1223/* -- module insert / remove -- */ 1223module_usb_driver(sd_driver);
1224static int __init sd_mod_init(void)
1225{
1226 return usb_register(&sd_driver);
1227}
1228static void __exit sd_mod_exit(void)
1229{
1230 usb_deregister(&sd_driver);
1231}
1232
1233module_init(sd_mod_init);
1234module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 7509d05dc065..1ac111176ffa 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -868,15 +868,4 @@ static struct usb_driver sd_driver = {
868#endif 868#endif
869}; 869};
870 870
871/* -- module insert / remove -- */ 871module_usb_driver(sd_driver);
872static int __init sd_mod_init(void)
873{
874 return usb_register(&sd_driver);
875}
876static void __exit sd_mod_exit(void)
877{
878 usb_deregister(&sd_driver);
879}
880
881module_init(sd_mod_init);
882module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/se401.c b/drivers/media/video/gspca/se401.c
index 3b71bbcd977a..1494e1829d36 100644
--- a/drivers/media/video/gspca/se401.c
+++ b/drivers/media/video/gspca/se401.c
@@ -766,15 +766,4 @@ static struct usb_driver sd_driver = {
766 .post_reset = sd_post_reset, 766 .post_reset = sd_post_reset,
767}; 767};
768 768
769/* -- module insert / remove -- */ 769module_usb_driver(sd_driver);
770static int __init sd_mod_init(void)
771{
772 return usb_register(&sd_driver);
773}
774static void __exit sd_mod_exit(void)
775{
776 usb_deregister(&sd_driver);
777}
778
779module_init(sd_mod_init);
780module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/sn9c2028.c b/drivers/media/video/gspca/sn9c2028.c
index 48aae3926a33..478533cb1152 100644
--- a/drivers/media/video/gspca/sn9c2028.c
+++ b/drivers/media/video/gspca/sn9c2028.c
@@ -737,16 +737,4 @@ static struct usb_driver sd_driver = {
737#endif 737#endif
738}; 738};
739 739
740/* -- module insert / remove -- */ 740module_usb_driver(sd_driver);
741static int __init sd_mod_init(void)
742{
743 return usb_register(&sd_driver);
744}
745
746static void __exit sd_mod_exit(void)
747{
748 usb_deregister(&sd_driver);
749}
750
751module_init(sd_mod_init);
752module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index 86e07a139a16..33cabc342dcf 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -2554,15 +2554,4 @@ static struct usb_driver sd_driver = {
2554#endif 2554#endif
2555}; 2555};
2556 2556
2557/* -- module insert / remove -- */ 2557module_usb_driver(sd_driver);
2558static int __init sd_mod_init(void)
2559{
2560 return usb_register(&sd_driver);
2561}
2562static void __exit sd_mod_exit(void)
2563{
2564 usb_deregister(&sd_driver);
2565}
2566
2567module_init(sd_mod_init);
2568module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 146b459b08d5..ddb392dc4f2d 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -1527,15 +1527,4 @@ static struct usb_driver sd_driver = {
1527#endif 1527#endif
1528}; 1528};
1529 1529
1530/* -- module insert / remove -- */ 1530module_usb_driver(sd_driver);
1531static int __init sd_mod_init(void)
1532{
1533 return usb_register(&sd_driver);
1534}
1535static void __exit sd_mod_exit(void)
1536{
1537 usb_deregister(&sd_driver);
1538}
1539
1540module_init(sd_mod_init);
1541module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index c746bf19ca14..afa3186b8038 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -3104,15 +3104,4 @@ static struct usb_driver sd_driver = {
3104#endif 3104#endif
3105}; 3105};
3106 3106
3107/* -- module insert / remove -- */ 3107module_usb_driver(sd_driver);
3108static int __init sd_mod_init(void)
3109{
3110 return usb_register(&sd_driver);
3111}
3112static void __exit sd_mod_exit(void)
3113{
3114 usb_deregister(&sd_driver);
3115}
3116
3117module_init(sd_mod_init);
3118module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/spca1528.c b/drivers/media/video/gspca/spca1528.c
index 695673106e76..070b9c33b517 100644
--- a/drivers/media/video/gspca/spca1528.c
+++ b/drivers/media/video/gspca/spca1528.c
@@ -590,15 +590,4 @@ static struct usb_driver sd_driver = {
590#endif 590#endif
591}; 591};
592 592
593/* -- module insert / remove -- */ 593module_usb_driver(sd_driver);
594static int __init sd_mod_init(void)
595{
596 return usb_register(&sd_driver);
597}
598static void __exit sd_mod_exit(void)
599{
600 usb_deregister(&sd_driver);
601}
602
603module_init(sd_mod_init);
604module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index bb82c94ece14..103984708c77 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -1092,15 +1092,4 @@ static struct usb_driver sd_driver = {
1092#endif 1092#endif
1093}; 1093};
1094 1094
1095/* -- module insert / remove -- */ 1095module_usb_driver(sd_driver);
1096static int __init sd_mod_init(void)
1097{
1098 return usb_register(&sd_driver);
1099}
1100static void __exit sd_mod_exit(void)
1101{
1102 usb_deregister(&sd_driver);
1103}
1104
1105module_init(sd_mod_init);
1106module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c
index 7aaac72aee91..9c16821addd4 100644
--- a/drivers/media/video/gspca/spca501.c
+++ b/drivers/media/video/gspca/spca501.c
@@ -2188,15 +2188,4 @@ static struct usb_driver sd_driver = {
2188#endif 2188#endif
2189}; 2189};
2190 2190
2191/* -- module insert / remove -- */ 2191module_usb_driver(sd_driver);
2192static int __init sd_mod_init(void)
2193{
2194 return usb_register(&sd_driver);
2195}
2196static void __exit sd_mod_exit(void)
2197{
2198 usb_deregister(&sd_driver);
2199}
2200
2201module_init(sd_mod_init);
2202module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c
index 16722dc60394..1320f35e39f2 100644
--- a/drivers/media/video/gspca/spca505.c
+++ b/drivers/media/video/gspca/spca505.c
@@ -815,15 +815,4 @@ static struct usb_driver sd_driver = {
815#endif 815#endif
816}; 816};
817 817
818/* -- module insert / remove -- */ 818module_usb_driver(sd_driver);
819static int __init sd_mod_init(void)
820{
821 return usb_register(&sd_driver);
822}
823static void __exit sd_mod_exit(void)
824{
825 usb_deregister(&sd_driver);
826}
827
828module_init(sd_mod_init);
829module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c
index 89fec4c500af..54eed87672d2 100644
--- a/drivers/media/video/gspca/spca506.c
+++ b/drivers/media/video/gspca/spca506.c
@@ -714,21 +714,4 @@ static struct usb_driver sd_driver = {
714#endif 714#endif
715}; 715};
716 716
717/* -- module insert / remove -- */ 717module_usb_driver(sd_driver);
718static int __init sd_mod_init(void)
719{
720 int ret;
721 ret = usb_register(&sd_driver);
722 if (ret < 0)
723 return ret;
724 PDEBUG(D_PROBE, "registered");
725 return 0;
726}
727static void __exit sd_mod_exit(void)
728{
729 usb_deregister(&sd_driver);
730 PDEBUG(D_PROBE, "deregistered");
731}
732
733module_init(sd_mod_init);
734module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index a44fe3d25965..df4e16996461 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -1544,15 +1544,4 @@ static struct usb_driver sd_driver = {
1544#endif 1544#endif
1545}; 1545};
1546 1546
1547/* -- module insert / remove -- */ 1547module_usb_driver(sd_driver);
1548static int __init sd_mod_init(void)
1549{
1550 return usb_register(&sd_driver);
1551}
1552static void __exit sd_mod_exit(void)
1553{
1554 usb_deregister(&sd_driver);
1555}
1556
1557module_init(sd_mod_init);
1558module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index c82fd53cef95..259a0c73c664 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -1106,15 +1106,4 @@ static struct usb_driver sd_driver = {
1106#endif 1106#endif
1107}; 1107};
1108 1108
1109/* -- module insert / remove -- */ 1109module_usb_driver(sd_driver);
1110static int __init sd_mod_init(void)
1111{
1112 return usb_register(&sd_driver);
1113}
1114static void __exit sd_mod_exit(void)
1115{
1116 usb_deregister(&sd_driver);
1117}
1118
1119module_init(sd_mod_init);
1120module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/sq905.c b/drivers/media/video/gspca/sq905.c
index df805f798282..2fe3c29bd6b7 100644
--- a/drivers/media/video/gspca/sq905.c
+++ b/drivers/media/video/gspca/sq905.c
@@ -432,16 +432,4 @@ static struct usb_driver sd_driver = {
432#endif 432#endif
433}; 433};
434 434
435/* -- module insert / remove -- */ 435module_usb_driver(sd_driver);
436static int __init sd_mod_init(void)
437{
438 return usb_register(&sd_driver);
439}
440
441static void __exit sd_mod_exit(void)
442{
443 usb_deregister(&sd_driver);
444}
445
446module_init(sd_mod_init);
447module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/sq905c.c b/drivers/media/video/gspca/sq905c.c
index c2c056056e08..ae783634712f 100644
--- a/drivers/media/video/gspca/sq905c.c
+++ b/drivers/media/video/gspca/sq905c.c
@@ -339,16 +339,4 @@ static struct usb_driver sd_driver = {
339#endif 339#endif
340}; 340};
341 341
342/* -- module insert / remove -- */ 342module_usb_driver(sd_driver);
343static int __init sd_mod_init(void)
344{
345 return usb_register(&sd_driver);
346}
347
348static void __exit sd_mod_exit(void)
349{
350 usb_deregister(&sd_driver);
351}
352
353module_init(sd_mod_init);
354module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/sq930x.c b/drivers/media/video/gspca/sq930x.c
index e4255b4905e7..1a8ba9b3550a 100644
--- a/drivers/media/video/gspca/sq930x.c
+++ b/drivers/media/video/gspca/sq930x.c
@@ -1197,15 +1197,4 @@ static struct usb_driver sd_driver = {
1197#endif 1197#endif
1198}; 1198};
1199 1199
1200/* -- module insert / remove -- */ 1200module_usb_driver(sd_driver);
1201static int __init sd_mod_init(void)
1202{
1203 return usb_register(&sd_driver);
1204}
1205static void __exit sd_mod_exit(void)
1206{
1207 usb_deregister(&sd_driver);
1208}
1209
1210module_init(sd_mod_init);
1211module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index 42a7a28a6c8b..4ae7cc8f463a 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -519,15 +519,4 @@ static struct usb_driver sd_driver = {
519#endif 519#endif
520}; 520};
521 521
522/* -- module insert / remove -- */ 522module_usb_driver(sd_driver);
523static int __init sd_mod_init(void)
524{
525 return usb_register(&sd_driver);
526}
527static void __exit sd_mod_exit(void)
528{
529 usb_deregister(&sd_driver);
530}
531
532module_init(sd_mod_init);
533module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/stv0680.c b/drivers/media/video/gspca/stv0680.c
index 4dcc7e37f9fd..461ed645f309 100644
--- a/drivers/media/video/gspca/stv0680.c
+++ b/drivers/media/video/gspca/stv0680.c
@@ -355,15 +355,4 @@ static struct usb_driver sd_driver = {
355#endif 355#endif
356}; 356};
357 357
358/* -- module insert / remove -- */ 358module_usb_driver(sd_driver);
359static int __init sd_mod_init(void)
360{
361 return usb_register(&sd_driver);
362}
363static void __exit sd_mod_exit(void)
364{
365 usb_deregister(&sd_driver);
366}
367
368module_init(sd_mod_init);
369module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c
index b1fca7db1015..0ab425fbea9a 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx.c
@@ -612,18 +612,7 @@ static struct usb_driver sd_driver = {
612#endif 612#endif
613}; 613};
614 614
615/* -- module insert / remove -- */ 615module_usb_driver(sd_driver);
616static int __init sd_mod_init(void)
617{
618 return usb_register(&sd_driver);
619}
620static void __exit sd_mod_exit(void)
621{
622 usb_deregister(&sd_driver);
623}
624
625module_init(sd_mod_init);
626module_exit(sd_mod_exit);
627 616
628module_param(dump_bridge, bool, S_IRUGO | S_IWUSR); 617module_param(dump_bridge, bool, S_IRUGO | S_IWUSR);
629MODULE_PARM_DESC(dump_bridge, "Dumps all usb bridge registers at startup"); 618MODULE_PARM_DESC(dump_bridge, "Dumps all usb bridge registers at startup");
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index c8909772435a..c80f0c0c75b6 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -1211,15 +1211,4 @@ static struct usb_driver sd_driver = {
1211#endif 1211#endif
1212}; 1212};
1213 1213
1214/* -- module insert / remove -- */ 1214module_usb_driver(sd_driver);
1215static int __init sd_mod_init(void)
1216{
1217 return usb_register(&sd_driver);
1218}
1219static void __exit sd_mod_exit(void)
1220{
1221 usb_deregister(&sd_driver);
1222}
1223
1224module_init(sd_mod_init);
1225module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index 90f0877eb599..ea44deb66af4 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -1438,15 +1438,4 @@ static struct usb_driver sd_driver = {
1438#endif 1438#endif
1439}; 1439};
1440 1440
1441/* -- module insert / remove -- */ 1441module_usb_driver(sd_driver);
1442static int __init sd_mod_init(void)
1443{
1444 return usb_register(&sd_driver);
1445}
1446static void __exit sd_mod_exit(void)
1447{
1448 usb_deregister(&sd_driver);
1449}
1450
1451module_init(sd_mod_init);
1452module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/topro.c b/drivers/media/video/gspca/topro.c
index 29596c59837f..b2695b1dc603 100644
--- a/drivers/media/video/gspca/topro.c
+++ b/drivers/media/video/gspca/topro.c
@@ -4971,18 +4971,7 @@ static struct usb_driver sd_driver = {
4971#endif 4971#endif
4972}; 4972};
4973 4973
4974/* -- module insert / remove -- */ 4974module_usb_driver(sd_driver);
4975static int __init sd_mod_init(void)
4976{
4977 return usb_register(&sd_driver);
4978}
4979static void __exit sd_mod_exit(void)
4980{
4981 usb_deregister(&sd_driver);
4982}
4983
4984module_init(sd_mod_init);
4985module_exit(sd_mod_exit);
4986 4975
4987module_param(force_sensor, int, 0644); 4976module_param(force_sensor, int, 0644);
4988MODULE_PARM_DESC(force_sensor, 4977MODULE_PARM_DESC(force_sensor,
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c
index 933ef2ca658c..c8922c5ffbf5 100644
--- a/drivers/media/video/gspca/tv8532.c
+++ b/drivers/media/video/gspca/tv8532.c
@@ -418,16 +418,4 @@ static struct usb_driver sd_driver = {
418#endif 418#endif
419}; 419};
420 420
421/* -- module insert / remove -- */ 421module_usb_driver(sd_driver);
422static int __init sd_mod_init(void)
423{
424 return usb_register(&sd_driver);
425}
426
427static void __exit sd_mod_exit(void)
428{
429 usb_deregister(&sd_driver);
430}
431
432module_init(sd_mod_init);
433module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c
index 7ee2c8271dcc..208f6b2d512a 100644
--- a/drivers/media/video/gspca/vc032x.c
+++ b/drivers/media/video/gspca/vc032x.c
@@ -4230,15 +4230,4 @@ static struct usb_driver sd_driver = {
4230#endif 4230#endif
4231}; 4231};
4232 4232
4233/* -- module insert / remove -- */ 4233module_usb_driver(sd_driver);
4234static int __init sd_mod_init(void)
4235{
4236 return usb_register(&sd_driver);
4237}
4238static void __exit sd_mod_exit(void)
4239{
4240 usb_deregister(&sd_driver);
4241}
4242
4243module_init(sd_mod_init);
4244module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/vicam.c b/drivers/media/video/gspca/vicam.c
index 81dd4c99d025..d12ea1518ace 100644
--- a/drivers/media/video/gspca/vicam.c
+++ b/drivers/media/video/gspca/vicam.c
@@ -368,16 +368,4 @@ static struct usb_driver sd_driver = {
368#endif 368#endif
369}; 369};
370 370
371/* -- module insert / remove -- */ 371module_usb_driver(sd_driver);
372static int __init sd_mod_init(void)
373{
374 return usb_register(&sd_driver);
375}
376
377static void __exit sd_mod_exit(void)
378{
379 usb_deregister(&sd_driver);
380}
381
382module_init(sd_mod_init);
383module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/xirlink_cit.c b/drivers/media/video/gspca/xirlink_cit.c
index 3aed42acdb5a..fbb6ed25ec31 100644
--- a/drivers/media/video/gspca/xirlink_cit.c
+++ b/drivers/media/video/gspca/xirlink_cit.c
@@ -3325,15 +3325,4 @@ static struct usb_driver sd_driver = {
3325#endif 3325#endif
3326}; 3326};
3327 3327
3328/* -- module insert / remove -- */ 3328module_usb_driver(sd_driver);
3329static int __init sd_mod_init(void)
3330{
3331 return usb_register(&sd_driver);
3332}
3333static void __exit sd_mod_exit(void)
3334{
3335 usb_deregister(&sd_driver);
3336}
3337
3338module_init(sd_mod_init);
3339module_exit(sd_mod_exit);
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
index 30ea1e479492..0202fead6b97 100644
--- a/drivers/media/video/gspca/zc3xx.c
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -7050,18 +7050,7 @@ static struct usb_driver sd_driver = {
7050#endif 7050#endif
7051}; 7051};
7052 7052
7053static int __init sd_mod_init(void) 7053module_usb_driver(sd_driver);
7054{
7055 return usb_register(&sd_driver);
7056}
7057
7058static void __exit sd_mod_exit(void)
7059{
7060 usb_deregister(&sd_driver);
7061}
7062
7063module_init(sd_mod_init);
7064module_exit(sd_mod_exit);
7065 7054
7066module_param(force_sensor, int, 0644); 7055module_param(force_sensor, int, 0644);
7067MODULE_PARM_DESC(force_sensor, 7056MODULE_PARM_DESC(force_sensor,
diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c
index 441dacf642bb..3f1a5b1beeba 100644
--- a/drivers/media/video/hdpvr/hdpvr-core.c
+++ b/drivers/media/video/hdpvr/hdpvr-core.c
@@ -452,26 +452,7 @@ static struct usb_driver hdpvr_usb_driver = {
452 .id_table = hdpvr_table, 452 .id_table = hdpvr_table,
453}; 453};
454 454
455static int __init hdpvr_init(void) 455module_usb_driver(hdpvr_usb_driver);
456{
457 int result;
458
459 /* register this driver with the USB subsystem */
460 result = usb_register(&hdpvr_usb_driver);
461 if (result)
462 err("usb_register failed. Error number %d", result);
463
464 return result;
465}
466
467static void __exit hdpvr_exit(void)
468{
469 /* deregister this driver with the USB subsystem */
470 usb_deregister(&hdpvr_usb_driver);
471}
472
473module_init(hdpvr_init);
474module_exit(hdpvr_exit);
475 456
476MODULE_LICENSE("GPL"); 457MODULE_LICENSE("GPL");
477MODULE_VERSION("0.2.1"); 458MODULE_VERSION("0.2.1");
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 803c9c82e496..c1bef6187661 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -2682,25 +2682,7 @@ static struct usb_driver s2255_driver = {
2682 .id_table = s2255_table, 2682 .id_table = s2255_table,
2683}; 2683};
2684 2684
2685static int __init usb_s2255_init(void) 2685module_usb_driver(s2255_driver);
2686{
2687 int result;
2688 /* register this driver with the USB subsystem */
2689 result = usb_register(&s2255_driver);
2690 if (result)
2691 pr_err(KBUILD_MODNAME
2692 ": usb_register failed. Error number %d\n", result);
2693 dprintk(2, "%s\n", __func__);
2694 return result;
2695}
2696
2697static void __exit usb_s2255_exit(void)
2698{
2699 usb_deregister(&s2255_driver);
2700}
2701
2702module_init(usb_s2255_init);
2703module_exit(usb_s2255_exit);
2704 2686
2705MODULE_DESCRIPTION("Sensoray 2255 Video for Linux driver"); 2687MODULE_DESCRIPTION("Sensoray 2255 Video for Linux driver");
2706MODULE_AUTHOR("Dean Anderson (Sensoray Company Inc.)"); 2688MODULE_AUTHOR("Dean Anderson (Sensoray Company Inc.)");
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c
index 16cb07c5c27b..7025be129286 100644
--- a/drivers/media/video/sn9c102/sn9c102_core.c
+++ b/drivers/media/video/sn9c102/sn9c102_core.c
@@ -3420,27 +3420,4 @@ static struct usb_driver sn9c102_usb_driver = {
3420 .disconnect = sn9c102_usb_disconnect, 3420 .disconnect = sn9c102_usb_disconnect,
3421}; 3421};
3422 3422
3423/*****************************************************************************/ 3423module_usb_driver(sn9c102_usb_driver);
3424
3425static int __init sn9c102_module_init(void)
3426{
3427 int err = 0;
3428
3429 KDBG(2, SN9C102_MODULE_NAME " v" SN9C102_MODULE_VERSION);
3430 KDBG(3, SN9C102_MODULE_AUTHOR);
3431
3432 if ((err = usb_register(&sn9c102_usb_driver)))
3433 KDBG(1, "usb_register() failed");
3434
3435 return err;
3436}
3437
3438
3439static void __exit sn9c102_module_exit(void)
3440{
3441 usb_deregister(&sn9c102_usb_driver);
3442}
3443
3444
3445module_init(sn9c102_module_init);
3446module_exit(sn9c102_module_exit);
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index cbc105f975de..b7fb5a5cad7e 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -1377,25 +1377,4 @@ static struct usb_driver stk_camera_driver = {
1377#endif 1377#endif
1378}; 1378};
1379 1379
1380 1380module_usb_driver(stk_camera_driver);
1381static int __init stk_camera_init(void)
1382{
1383 int result;
1384
1385 result = usb_register(&stk_camera_driver);
1386 if (result)
1387 STK_ERROR("usb_register failed ! Error number %d\n", result);
1388
1389
1390 return result;
1391}
1392
1393static void __exit stk_camera_exit(void)
1394{
1395 usb_deregister(&stk_camera_driver);
1396}
1397
1398module_init(stk_camera_init);
1399module_exit(stk_camera_exit);
1400
1401
diff --git a/drivers/media/video/tm6000/tm6000-cards.c b/drivers/media/video/tm6000/tm6000-cards.c
index ec2578a0fdf7..ff939bc0e0b9 100644
--- a/drivers/media/video/tm6000/tm6000-cards.c
+++ b/drivers/media/video/tm6000/tm6000-cards.c
@@ -1371,31 +1371,7 @@ static struct usb_driver tm6000_usb_driver = {
1371 .id_table = tm6000_id_table, 1371 .id_table = tm6000_id_table,
1372}; 1372};
1373 1373
1374static int __init tm6000_module_init(void) 1374module_usb_driver(tm6000_usb_driver);
1375{
1376 int result;
1377
1378 printk(KERN_INFO "tm6000" " v4l2 driver version %d.%d.%d loaded\n",
1379 (TM6000_VERSION >> 16) & 0xff,
1380 (TM6000_VERSION >> 8) & 0xff, TM6000_VERSION & 0xff);
1381
1382 /* register this driver with the USB subsystem */
1383 result = usb_register(&tm6000_usb_driver);
1384 if (result)
1385 printk(KERN_ERR "tm6000"
1386 " usb_register failed. Error number %d.\n", result);
1387
1388 return result;
1389}
1390
1391static void __exit tm6000_module_exit(void)
1392{
1393 /* deregister at USB subsystem */
1394 usb_deregister(&tm6000_usb_driver);
1395}
1396
1397module_init(tm6000_module_init);
1398module_exit(tm6000_module_exit);
1399 1375
1400MODULE_DESCRIPTION("Trident TVMaster TM5600/TM6000/TM6010 USB2 adapter"); 1376MODULE_DESCRIPTION("Trident TVMaster TM5600/TM6000/TM6010 USB2 adapter");
1401MODULE_AUTHOR("Mauro Carvalho Chehab"); 1377MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c
index e78cf94f491e..cd2e39fc4bf0 100644
--- a/drivers/media/video/zr364xx.c
+++ b/drivers/media/video/zr364xx.c
@@ -1695,28 +1695,7 @@ static struct usb_driver zr364xx_driver = {
1695 .id_table = device_table 1695 .id_table = device_table
1696}; 1696};
1697 1697
1698 1698module_usb_driver(zr364xx_driver);
1699static int __init zr364xx_init(void)
1700{
1701 int retval;
1702 retval = usb_register(&zr364xx_driver);
1703 if (retval)
1704 printk(KERN_ERR KBUILD_MODNAME ": usb_register failed!\n");
1705 else
1706 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
1707 return retval;
1708}
1709
1710
1711static void __exit zr364xx_exit(void)
1712{
1713 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC " module unloaded\n");
1714 usb_deregister(&zr364xx_driver);
1715}
1716
1717
1718module_init(zr364xx_init);
1719module_exit(zr364xx_exit);
1720 1699
1721MODULE_AUTHOR(DRIVER_AUTHOR); 1700MODULE_AUTHOR(DRIVER_AUTHOR);
1722MODULE_DESCRIPTION(DRIVER_DESC); 1701MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c
index f08f944ac53c..c0105a2e269a 100644
--- a/drivers/mmc/host/ushc.c
+++ b/drivers/mmc/host/ushc.c
@@ -562,17 +562,7 @@ static struct usb_driver ushc_driver = {
562 .disconnect = ushc_disconnect, 562 .disconnect = ushc_disconnect,
563}; 563};
564 564
565static int __init ushc_init(void) 565module_usb_driver(ushc_driver);
566{
567 return usb_register(&ushc_driver);
568}
569module_init(ushc_init);
570
571static void __exit ushc_exit(void)
572{
573 usb_deregister(&ushc_driver);
574}
575module_exit(ushc_exit);
576 566
577MODULE_DESCRIPTION("USB SD Host Controller driver"); 567MODULE_DESCRIPTION("USB SD Host Controller driver");
578MODULE_AUTHOR("David Vrabel <david.vrabel@csr.com>"); 568MODULE_AUTHOR("David Vrabel <david.vrabel@csr.com>");
diff --git a/drivers/mtd/nand/alauda.c b/drivers/mtd/nand/alauda.c
index eb40ea829ab2..6a5ff64a139e 100644
--- a/drivers/mtd/nand/alauda.c
+++ b/drivers/mtd/nand/alauda.c
@@ -717,17 +717,6 @@ static struct usb_driver alauda_driver = {
717 .id_table = alauda_table, 717 .id_table = alauda_table,
718}; 718};
719 719
720static int __init alauda_init(void) 720module_usb_driver(alauda_driver);
721{
722 return usb_register(&alauda_driver);
723}
724
725static void __exit alauda_exit(void)
726{
727 usb_deregister(&alauda_driver);
728}
729
730module_init(alauda_init);
731module_exit(alauda_exit);
732 721
733MODULE_LICENSE("GPL"); 722MODULE_LICENSE("GPL");
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 4ef7e2fd9fe6..aef42f045320 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -26,7 +26,6 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/sched.h> 28#include <linux/sched.h>
29#include <linux/sysdev.h>
30#include <linux/fs.h> 29#include <linux/fs.h>
31#include <linux/types.h> 30#include <linux/types.h>
32#include <linux/string.h> 31#include <linux/string.h>
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index a72c7bfb4090..9697c14b8dc6 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -1115,28 +1115,4 @@ static struct usb_driver ems_usb_driver = {
1115 .id_table = ems_usb_table, 1115 .id_table = ems_usb_table,
1116}; 1116};
1117 1117
1118static int __init ems_usb_init(void) 1118module_usb_driver(ems_usb_driver);
1119{
1120 int err;
1121
1122 printk(KERN_INFO "CPC-USB kernel driver loaded\n");
1123
1124 /* register this driver with the USB subsystem */
1125 err = usb_register(&ems_usb_driver);
1126
1127 if (err) {
1128 err("usb_register failed. Error number %d\n", err);
1129 return err;
1130 }
1131
1132 return 0;
1133}
1134
1135static void __exit ems_usb_exit(void)
1136{
1137 /* deregister this driver with the USB subsystem */
1138 usb_deregister(&ems_usb_driver);
1139}
1140
1141module_init(ems_usb_init);
1142module_exit(ems_usb_exit);
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index eb8b0e600282..92774637aad8 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -1108,25 +1108,4 @@ static struct usb_driver esd_usb2_driver = {
1108 .id_table = esd_usb2_table, 1108 .id_table = esd_usb2_table,
1109}; 1109};
1110 1110
1111static int __init esd_usb2_init(void) 1111module_usb_driver(esd_usb2_driver);
1112{
1113 int err;
1114
1115 /* register this driver with the USB subsystem */
1116 err = usb_register(&esd_usb2_driver);
1117
1118 if (err) {
1119 err("usb_register failed. Error number %d\n", err);
1120 return err;
1121 }
1122
1123 return 0;
1124}
1125module_init(esd_usb2_init);
1126
1127static void __exit esd_usb2_exit(void)
1128{
1129 /* deregister this driver with the USB subsystem */
1130 usb_deregister(&esd_usb2_driver);
1131}
1132module_exit(esd_usb2_exit);
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index d9267cb98a23..72f687b40d66 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1914,41 +1914,8 @@ static struct usb_driver irda_driver = {
1914#endif 1914#endif
1915}; 1915};
1916 1916
1917/************************* MODULE CALLBACKS *************************/ 1917module_usb_driver(irda_driver);
1918/*
1919 * Deal with module insertion/removal
1920 * Mostly tell USB about our existence
1921 */
1922
1923/*------------------------------------------------------------------*/
1924/*
1925 * Module insertion
1926 */
1927static int __init usb_irda_init(void)
1928{
1929 int ret;
1930
1931 ret = usb_register(&irda_driver);
1932 if (ret < 0)
1933 return ret;
1934
1935 IRDA_MESSAGE("USB IrDA support registered\n");
1936 return 0;
1937}
1938module_init(usb_irda_init);
1939 1918
1940/*------------------------------------------------------------------*/
1941/*
1942 * Module removal
1943 */
1944static void __exit usb_irda_cleanup(void)
1945{
1946 /* Deregister the driver and remove all pending instances */
1947 usb_deregister(&irda_driver);
1948}
1949module_exit(usb_irda_cleanup);
1950
1951/*------------------------------------------------------------------*/
1952/* 1919/*
1953 * Module parameters 1920 * Module parameters
1954 */ 1921 */
diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c
index cb90d640007a..79aebeee928c 100644
--- a/drivers/net/irda/kingsun-sir.c
+++ b/drivers/net/irda/kingsun-sir.c
@@ -621,24 +621,7 @@ static struct usb_driver irda_driver = {
621#endif 621#endif
622}; 622};
623 623
624/* 624module_usb_driver(irda_driver);
625 * Module insertion
626 */
627static int __init kingsun_init(void)
628{
629 return usb_register(&irda_driver);
630}
631module_init(kingsun_init);
632
633/*
634 * Module removal
635 */
636static void __exit kingsun_cleanup(void)
637{
638 /* Deregister the driver and remove all pending instances */
639 usb_deregister(&irda_driver);
640}
641module_exit(kingsun_cleanup);
642 625
643MODULE_AUTHOR("Alex Villacís Lasso <a_villacis@palosanto.com>"); 626MODULE_AUTHOR("Alex Villacís Lasso <a_villacis@palosanto.com>");
644MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun/DonShine"); 627MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun/DonShine");
diff --git a/drivers/net/irda/ks959-sir.c b/drivers/net/irda/ks959-sir.c
index 1046014dd6c2..abe689dffc72 100644
--- a/drivers/net/irda/ks959-sir.c
+++ b/drivers/net/irda/ks959-sir.c
@@ -901,26 +901,7 @@ static struct usb_driver irda_driver = {
901#endif 901#endif
902}; 902};
903 903
904/* 904module_usb_driver(irda_driver);
905 * Module insertion
906 */
907static int __init ks959_init(void)
908{
909 return usb_register(&irda_driver);
910}
911
912module_init(ks959_init);
913
914/*
915 * Module removal
916 */
917static void __exit ks959_cleanup(void)
918{
919 /* Deregister the driver and remove all pending instances */
920 usb_deregister(&irda_driver);
921}
922
923module_exit(ks959_cleanup);
924 905
925MODULE_AUTHOR("Alex Villacís Lasso <a_villacis@palosanto.com>"); 906MODULE_AUTHOR("Alex Villacís Lasso <a_villacis@palosanto.com>");
926MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun KS-959"); 907MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun KS-959");
diff --git a/drivers/net/irda/ksdazzle-sir.c b/drivers/net/irda/ksdazzle-sir.c
index 9cc142fcc712..f8c01088eeb7 100644
--- a/drivers/net/irda/ksdazzle-sir.c
+++ b/drivers/net/irda/ksdazzle-sir.c
@@ -796,26 +796,7 @@ static struct usb_driver irda_driver = {
796#endif 796#endif
797}; 797};
798 798
799/* 799module_usb_driver(irda_driver);
800 * Module insertion
801 */
802static int __init ksdazzle_init(void)
803{
804 return usb_register(&irda_driver);
805}
806
807module_init(ksdazzle_init);
808
809/*
810 * Module removal
811 */
812static void __exit ksdazzle_cleanup(void)
813{
814 /* Deregister the driver and remove all pending instances */
815 usb_deregister(&irda_driver);
816}
817
818module_exit(ksdazzle_cleanup);
819 800
820MODULE_AUTHOR("Alex Villacís Lasso <a_villacis@palosanto.com>"); 801MODULE_AUTHOR("Alex Villacís Lasso <a_villacis@palosanto.com>");
821MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun Dazzle"); 802MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun Dazzle");
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index be52bfed66a9..1a00b5990cb8 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -968,25 +968,4 @@ static void mcs_disconnect(struct usb_interface *intf)
968 IRDA_DEBUG(0, "MCS7780 now disconnected.\n"); 968 IRDA_DEBUG(0, "MCS7780 now disconnected.\n");
969} 969}
970 970
971/* Module insertion */ 971module_usb_driver(mcs_driver);
972static int __init mcs_init(void)
973{
974 int result;
975
976 /* register this driver with the USB subsystem */
977 result = usb_register(&mcs_driver);
978 if (result)
979 IRDA_ERROR("usb_register failed. Error number %d\n", result);
980
981 return result;
982}
983module_init(mcs_init);
984
985/* Module removal */
986static void __exit mcs_exit(void)
987{
988 /* deregister this driver with the USB subsystem */
989 usb_deregister(&mcs_driver);
990}
991module_exit(mcs_exit);
992
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 41c96b3d8152..212868eb6f5f 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -1133,21 +1133,4 @@ static struct usb_driver irda_driver = {
1133#endif 1133#endif
1134}; 1134};
1135 1135
1136/* 1136module_usb_driver(irda_driver);
1137 * Module insertion
1138 */
1139static int __init stir_init(void)
1140{
1141 return usb_register(&irda_driver);
1142}
1143module_init(stir_init);
1144
1145/*
1146 * Module removal
1147 */
1148static void __exit stir_cleanup(void)
1149{
1150 /* Deregister the driver and remove all pending instances */
1151 usb_deregister(&irda_driver);
1152}
1153module_exit(stir_cleanup);
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index e95f0e60a9bc..823715ac1277 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -1674,17 +1674,7 @@ static struct usb_driver asix_driver = {
1674 .supports_autosuspend = 1, 1674 .supports_autosuspend = 1,
1675}; 1675};
1676 1676
1677static int __init asix_init(void) 1677module_usb_driver(asix_driver);
1678{
1679 return usb_register(&asix_driver);
1680}
1681module_init(asix_init);
1682
1683static void __exit asix_exit(void)
1684{
1685 usb_deregister(&asix_driver);
1686}
1687module_exit(asix_exit);
1688 1678
1689MODULE_AUTHOR("David Hollis"); 1679MODULE_AUTHOR("David Hollis");
1690MODULE_VERSION(DRIVER_VERSION); 1680MODULE_VERSION(DRIVER_VERSION);
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index a68272c93381..182cfb4aeb1d 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -949,19 +949,4 @@ static struct usb_driver catc_driver = {
949 .id_table = catc_id_table, 949 .id_table = catc_id_table,
950}; 950};
951 951
952static int __init catc_init(void) 952module_usb_driver(catc_driver);
953{
954 int result = usb_register(&catc_driver);
955 if (result == 0)
956 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
957 DRIVER_DESC "\n");
958 return result;
959}
960
961static void __exit catc_exit(void)
962{
963 usb_deregister(&catc_driver);
964}
965
966module_init(catc_init);
967module_exit(catc_exit);
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index a60d0069cc45..30aedcd55975 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -457,18 +457,7 @@ static struct usb_driver usbpn_driver = {
457 .id_table = usbpn_ids, 457 .id_table = usbpn_ids,
458}; 458};
459 459
460static int __init usbpn_init(void) 460module_usb_driver(usbpn_driver);
461{
462 return usb_register(&usbpn_driver);
463}
464
465static void __exit usbpn_exit(void)
466{
467 usb_deregister(&usbpn_driver);
468}
469
470module_init(usbpn_init);
471module_exit(usbpn_exit);
472 461
473MODULE_AUTHOR("Remi Denis-Courmont"); 462MODULE_AUTHOR("Remi Denis-Courmont");
474MODULE_DESCRIPTION("USB CDC Phonet host interface"); 463MODULE_DESCRIPTION("USB CDC Phonet host interface");
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 882f53f708df..439690be519f 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -369,18 +369,7 @@ static struct usb_driver eem_driver = {
369 .resume = usbnet_resume, 369 .resume = usbnet_resume,
370}; 370};
371 371
372 372module_usb_driver(eem_driver);
373static int __init eem_init(void)
374{
375 return usb_register(&eem_driver);
376}
377module_init(eem_init);
378
379static void __exit eem_exit(void)
380{
381 usb_deregister(&eem_driver);
382}
383module_exit(eem_exit);
384 373
385MODULE_AUTHOR("Omar Laazimani <omar.oberthur@gmail.com>"); 374MODULE_AUTHOR("Omar Laazimani <omar.oberthur@gmail.com>");
386MODULE_DESCRIPTION("USB CDC EEM"); 375MODULE_DESCRIPTION("USB CDC EEM");
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 99ed6eb4dfaf..41a61efc331e 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -425,6 +425,9 @@ int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
425 int status; 425 int status;
426 struct cdc_state *info = (void *) &dev->data; 426 struct cdc_state *info = (void *) &dev->data;
427 427
428 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
429 < sizeof(struct cdc_state)));
430
428 status = usbnet_generic_cdc_bind(dev, intf); 431 status = usbnet_generic_cdc_bind(dev, intf);
429 if (status < 0) 432 if (status < 0)
430 return status; 433 return status;
@@ -615,21 +618,7 @@ static struct usb_driver cdc_driver = {
615 .supports_autosuspend = 1, 618 .supports_autosuspend = 1,
616}; 619};
617 620
618 621module_usb_driver(cdc_driver);
619static int __init cdc_init(void)
620{
621 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
622 < sizeof(struct cdc_state)));
623
624 return usb_register(&cdc_driver);
625}
626module_init(cdc_init);
627
628static void __exit cdc_exit(void)
629{
630 usb_deregister(&cdc_driver);
631}
632module_exit(cdc_exit);
633 622
634MODULE_AUTHOR("David Brownell"); 623MODULE_AUTHOR("David Brownell");
635MODULE_DESCRIPTION("USB CDC Ethernet devices"); 624MODULE_DESCRIPTION("USB CDC Ethernet devices");
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index f06fb78383a1..9904b7ebca2d 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1232,20 +1232,7 @@ static struct ethtool_ops cdc_ncm_ethtool_ops = {
1232 .nway_reset = usbnet_nway_reset, 1232 .nway_reset = usbnet_nway_reset,
1233}; 1233};
1234 1234
1235static int __init cdc_ncm_init(void) 1235module_usb_driver(cdc_ncm_driver);
1236{
1237 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION "\n");
1238 return usb_register(&cdc_ncm_driver);
1239}
1240
1241module_init(cdc_ncm_init);
1242
1243static void __exit cdc_ncm_exit(void)
1244{
1245 usb_deregister(&cdc_ncm_driver);
1246}
1247
1248module_exit(cdc_ncm_exit);
1249 1236
1250MODULE_AUTHOR("Hans Petter Selasky"); 1237MODULE_AUTHOR("Hans Petter Selasky");
1251MODULE_DESCRIPTION("USB CDC NCM host driver"); 1238MODULE_DESCRIPTION("USB CDC NCM host driver");
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
index fc5f13d47ad9..b403d934e4e3 100644
--- a/drivers/net/usb/cdc_subset.c
+++ b/drivers/net/usb/cdc_subset.c
@@ -338,17 +338,7 @@ static struct usb_driver cdc_subset_driver = {
338 .id_table = products, 338 .id_table = products,
339}; 339};
340 340
341static int __init cdc_subset_init(void) 341module_usb_driver(cdc_subset_driver);
342{
343 return usb_register(&cdc_subset_driver);
344}
345module_init(cdc_subset_init);
346
347static void __exit cdc_subset_exit(void)
348{
349 usb_deregister(&cdc_subset_driver);
350}
351module_exit(cdc_subset_exit);
352 342
353MODULE_AUTHOR("David Brownell"); 343MODULE_AUTHOR("David Brownell");
354MODULE_DESCRIPTION("Simple 'CDC Subset' USB networking links"); 344MODULE_DESCRIPTION("Simple 'CDC Subset' USB networking links");
diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c
index 8969f124c18c..0e0531356e62 100644
--- a/drivers/net/usb/cx82310_eth.c
+++ b/drivers/net/usb/cx82310_eth.c
@@ -329,17 +329,7 @@ static struct usb_driver cx82310_driver = {
329 .resume = usbnet_resume, 329 .resume = usbnet_resume,
330}; 330};
331 331
332static int __init cx82310_init(void) 332module_usb_driver(cx82310_driver);
333{
334 return usb_register(&cx82310_driver);
335}
336module_init(cx82310_init);
337
338static void __exit cx82310_exit(void)
339{
340 usb_deregister(&cx82310_driver);
341}
342module_exit(cx82310_exit);
343 333
344MODULE_AUTHOR("Ondrej Zary"); 334MODULE_AUTHOR("Ondrej Zary");
345MODULE_DESCRIPTION("Conexant CX82310-based ADSL router USB ethernet driver"); 335MODULE_DESCRIPTION("Conexant CX82310-based ADSL router USB ethernet driver");
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index fbc0e4def767..b97226318ea5 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -672,18 +672,7 @@ static struct usb_driver dm9601_driver = {
672 .resume = usbnet_resume, 672 .resume = usbnet_resume,
673}; 673};
674 674
675static int __init dm9601_init(void) 675module_usb_driver(dm9601_driver);
676{
677 return usb_register(&dm9601_driver);
678}
679
680static void __exit dm9601_exit(void)
681{
682 usb_deregister(&dm9601_driver);
683}
684
685module_init(dm9601_init);
686module_exit(dm9601_exit);
687 676
688MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>"); 677MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>");
689MODULE_DESCRIPTION("Davicom DM9601 USB 1.1 ethernet devices"); 678MODULE_DESCRIPTION("Davicom DM9601 USB 1.1 ethernet devices");
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c
index c4cfd1dea881..38266bdae26b 100644
--- a/drivers/net/usb/gl620a.c
+++ b/drivers/net/usb/gl620a.c
@@ -227,17 +227,7 @@ static struct usb_driver gl620a_driver = {
227 .resume = usbnet_resume, 227 .resume = usbnet_resume,
228}; 228};
229 229
230static int __init usbnet_init(void) 230module_usb_driver(gl620a_driver);
231{
232 return usb_register(&gl620a_driver);
233}
234module_init(usbnet_init);
235
236static void __exit usbnet_exit(void)
237{
238 usb_deregister(&gl620a_driver);
239}
240module_exit(usbnet_exit);
241 231
242MODULE_AUTHOR("Jiun-Jie Huang"); 232MODULE_AUTHOR("Jiun-Jie Huang");
243MODULE_DESCRIPTION("GL620-USB-A Host-to-Host Link cables"); 233MODULE_DESCRIPTION("GL620-USB-A Host-to-Host Link cables");
diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c
index 131ac6c172f6..12a22a453ff1 100644
--- a/drivers/net/usb/int51x1.c
+++ b/drivers/net/usb/int51x1.c
@@ -238,17 +238,7 @@ static struct usb_driver int51x1_driver = {
238 .resume = usbnet_resume, 238 .resume = usbnet_resume,
239}; 239};
240 240
241static int __init int51x1_init(void) 241module_usb_driver(int51x1_driver);
242{
243 return usb_register(&int51x1_driver);
244}
245module_init(int51x1_init);
246
247static void __exit int51x1_exit(void)
248{
249 usb_deregister(&int51x1_driver);
250}
251module_exit(int51x1_exit);
252 242
253MODULE_AUTHOR("Peter Holik"); 243MODULE_AUTHOR("Peter Holik");
254MODULE_DESCRIPTION("Intellon usb powerline adapter"); 244MODULE_DESCRIPTION("Intellon usb powerline adapter");
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 13c1f044b40d..08a4df238796 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -543,25 +543,7 @@ static struct usb_driver ipheth_driver = {
543 .id_table = ipheth_table, 543 .id_table = ipheth_table,
544}; 544};
545 545
546static int __init ipheth_init(void) 546module_usb_driver(ipheth_driver);
547{
548 int retval;
549
550 retval = usb_register(&ipheth_driver);
551 if (retval) {
552 err("usb_register failed: %d", retval);
553 return retval;
554 }
555 return 0;
556}
557
558static void __exit ipheth_exit(void)
559{
560 usb_deregister(&ipheth_driver);
561}
562
563module_init(ipheth_init);
564module_exit(ipheth_exit);
565 547
566MODULE_AUTHOR("Diego Giagio <diego@giagio.com>"); 548MODULE_AUTHOR("Diego Giagio <diego@giagio.com>");
567MODULE_DESCRIPTION("Apple iPhone USB Ethernet driver"); 549MODULE_DESCRIPTION("Apple iPhone USB Ethernet driver");
diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c
index 5a6d0f88f43b..7562649b3d6b 100644
--- a/drivers/net/usb/kalmia.c
+++ b/drivers/net/usb/kalmia.c
@@ -375,17 +375,7 @@ static struct usb_driver kalmia_driver = {
375 .resume = usbnet_resume 375 .resume = usbnet_resume
376}; 376};
377 377
378static int __init kalmia_init(void) 378module_usb_driver(kalmia_driver);
379{
380 return usb_register(&kalmia_driver);
381}
382module_init( kalmia_init);
383
384static void __exit kalmia_exit(void)
385{
386 usb_deregister(&kalmia_driver);
387}
388module_exit( kalmia_exit);
389 379
390MODULE_AUTHOR("Marius Bjoernstad Kotsbak <marius@kotsbak.com>"); 380MODULE_AUTHOR("Marius Bjoernstad Kotsbak <marius@kotsbak.com>");
391MODULE_DESCRIPTION("Samsung Kalmia USB network driver"); 381MODULE_DESCRIPTION("Samsung Kalmia USB network driver");
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 582ca2dfa5f9..d034d9c42548 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1324,32 +1324,4 @@ static int kaweth_internal_control_msg(struct usb_device *usb_dev,
1324 } 1324 }
1325} 1325}
1326 1326
1327 1327module_usb_driver(kaweth_driver);
1328/****************************************************************
1329 * kaweth_init
1330 ****************************************************************/
1331static int __init kaweth_init(void)
1332{
1333 dbg("Driver loading");
1334 return usb_register(&kaweth_driver);
1335}
1336
1337/****************************************************************
1338 * kaweth_exit
1339 ****************************************************************/
1340static void __exit kaweth_exit(void)
1341{
1342 usb_deregister(&kaweth_driver);
1343}
1344
1345module_init(kaweth_init);
1346module_exit(kaweth_exit);
1347
1348
1349
1350
1351
1352
1353
1354
1355
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c
index 9c26c6390d69..45a981fde43f 100644
--- a/drivers/net/usb/lg-vl600.c
+++ b/drivers/net/usb/lg-vl600.c
@@ -346,17 +346,7 @@ static struct usb_driver lg_vl600_driver = {
346 .resume = usbnet_resume, 346 .resume = usbnet_resume,
347}; 347};
348 348
349static int __init vl600_init(void) 349module_usb_driver(lg_vl600_driver);
350{
351 return usb_register(&lg_vl600_driver);
352}
353module_init(vl600_init);
354
355static void __exit vl600_exit(void)
356{
357 usb_deregister(&lg_vl600_driver);
358}
359module_exit(vl600_exit);
360 350
361MODULE_AUTHOR("Anrzej Zaborowski"); 351MODULE_AUTHOR("Anrzej Zaborowski");
362MODULE_DESCRIPTION("LG-VL600 modem's ethernet link"); 352MODULE_DESCRIPTION("LG-VL600 modem's ethernet link");
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index db2cb74bf854..a29aa9cf9f6e 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -692,17 +692,7 @@ static struct usb_driver mcs7830_driver = {
692 .reset_resume = mcs7830_reset_resume, 692 .reset_resume = mcs7830_reset_resume,
693}; 693};
694 694
695static int __init mcs7830_init(void) 695module_usb_driver(mcs7830_driver);
696{
697 return usb_register(&mcs7830_driver);
698}
699module_init(mcs7830_init);
700
701static void __exit mcs7830_exit(void)
702{
703 usb_deregister(&mcs7830_driver);
704}
705module_exit(mcs7830_exit);
706 696
707MODULE_DESCRIPTION("USB to network adapter MCS7830)"); 697MODULE_DESCRIPTION("USB to network adapter MCS7830)");
708MODULE_LICENSE("GPL"); 698MODULE_LICENSE("GPL");
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
index 01db4602a39e..83f965cb69e7 100644
--- a/drivers/net/usb/net1080.c
+++ b/drivers/net/usb/net1080.c
@@ -589,17 +589,7 @@ static struct usb_driver net1080_driver = {
589 .resume = usbnet_resume, 589 .resume = usbnet_resume,
590}; 590};
591 591
592static int __init net1080_init(void) 592module_usb_driver(net1080_driver);
593{
594 return usb_register(&net1080_driver);
595}
596module_init(net1080_init);
597
598static void __exit net1080_exit(void)
599{
600 usb_deregister(&net1080_driver);
601}
602module_exit(net1080_exit);
603 593
604MODULE_AUTHOR("David Brownell"); 594MODULE_AUTHOR("David Brownell");
605MODULE_DESCRIPTION("NetChip 1080 based USB Host-to-Host Links"); 595MODULE_DESCRIPTION("NetChip 1080 based USB Host-to-Host Links");
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 217aec8a768f..b2b035e29978 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -154,17 +154,7 @@ static struct usb_driver plusb_driver = {
154 .resume = usbnet_resume, 154 .resume = usbnet_resume,
155}; 155};
156 156
157static int __init plusb_init(void) 157module_usb_driver(plusb_driver);
158{
159 return usb_register(&plusb_driver);
160}
161module_init(plusb_init);
162
163static void __exit plusb_exit(void)
164{
165 usb_deregister(&plusb_driver);
166}
167module_exit(plusb_exit);
168 158
169MODULE_AUTHOR("David Brownell"); 159MODULE_AUTHOR("David Brownell");
170MODULE_DESCRIPTION("Prolific PL-2301/2302/25A1 USB Host to Host Link Driver"); 160MODULE_DESCRIPTION("Prolific PL-2301/2302/25A1 USB Host to Host Link Driver");
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 255d6a424a6b..c8f1b5b3aff3 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -635,17 +635,7 @@ static struct usb_driver rndis_driver = {
635 .resume = usbnet_resume, 635 .resume = usbnet_resume,
636}; 636};
637 637
638static int __init rndis_init(void) 638module_usb_driver(rndis_driver);
639{
640 return usb_register(&rndis_driver);
641}
642module_init(rndis_init);
643
644static void __exit rndis_exit(void)
645{
646 usb_deregister(&rndis_driver);
647}
648module_exit(rndis_exit);
649 639
650MODULE_AUTHOR("David Brownell"); 640MODULE_AUTHOR("David Brownell");
651MODULE_DESCRIPTION("USB Host side RNDIS driver"); 641MODULE_DESCRIPTION("USB Host side RNDIS driver");
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index bf8c84d0adf2..0710b4ca9252 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -978,20 +978,7 @@ static struct usb_driver rtl8150_driver = {
978 .resume = rtl8150_resume 978 .resume = rtl8150_resume
979}; 979};
980 980
981static int __init usb_rtl8150_init(void) 981module_usb_driver(rtl8150_driver);
982{
983 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
984 DRIVER_DESC "\n");
985 return usb_register(&rtl8150_driver);
986}
987
988static void __exit usb_rtl8150_exit(void)
989{
990 usb_deregister(&rtl8150_driver);
991}
992
993module_init(usb_rtl8150_init);
994module_exit(usb_rtl8150_exit);
995 982
996MODULE_AUTHOR(DRIVER_AUTHOR); 983MODULE_AUTHOR(DRIVER_AUTHOR);
997MODULE_DESCRIPTION(DRIVER_DESC); 984MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index ed1b43210584..e45dfdcb8718 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -900,6 +900,9 @@ struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
900 u16 len; 900 u16 len;
901 bool need_tail; 901 bool need_tail;
902 902
903 BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data)
904 < sizeof(struct cdc_state));
905
903 dev_dbg(&dev->udev->dev, "%s", __func__); 906 dev_dbg(&dev->udev->dev, "%s", __func__);
904 if (priv->link_up && check_ethip_packet(skb, dev) && is_ip(skb)) { 907 if (priv->link_up && check_ethip_packet(skb, dev) && is_ip(skb)) {
905 /* enough head room as is? */ 908 /* enough head room as is? */
@@ -981,21 +984,7 @@ static struct usb_driver sierra_net_driver = {
981 .no_dynamic_id = 1, 984 .no_dynamic_id = 1,
982}; 985};
983 986
984static int __init sierra_net_init(void) 987module_usb_driver(sierra_net_driver);
985{
986 BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data)
987 < sizeof(struct cdc_state));
988
989 return usb_register(&sierra_net_driver);
990}
991
992static void __exit sierra_net_exit(void)
993{
994 usb_deregister(&sierra_net_driver);
995}
996
997module_exit(sierra_net_exit);
998module_init(sierra_net_init);
999 988
1000MODULE_AUTHOR(DRIVER_AUTHOR); 989MODULE_AUTHOR(DRIVER_AUTHOR);
1001MODULE_DESCRIPTION(DRIVER_DESC); 990MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index a5b9b12ef268..e85840ee36e0 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -1237,17 +1237,7 @@ static struct usb_driver smsc75xx_driver = {
1237 .disconnect = usbnet_disconnect, 1237 .disconnect = usbnet_disconnect,
1238}; 1238};
1239 1239
1240static int __init smsc75xx_init(void) 1240module_usb_driver(smsc75xx_driver);
1241{
1242 return usb_register(&smsc75xx_driver);
1243}
1244module_init(smsc75xx_init);
1245
1246static void __exit smsc75xx_exit(void)
1247{
1248 usb_deregister(&smsc75xx_driver);
1249}
1250module_exit(smsc75xx_exit);
1251 1241
1252MODULE_AUTHOR("Nancy Lin"); 1242MODULE_AUTHOR("Nancy Lin");
1253MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>"); 1243MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>");
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index eff67678c5a6..4a107610ac43 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1297,17 +1297,7 @@ static struct usb_driver smsc95xx_driver = {
1297 .disconnect = usbnet_disconnect, 1297 .disconnect = usbnet_disconnect,
1298}; 1298};
1299 1299
1300static int __init smsc95xx_init(void) 1300module_usb_driver(smsc95xx_driver);
1301{
1302 return usb_register(&smsc95xx_driver);
1303}
1304module_init(smsc95xx_init);
1305
1306static void __exit smsc95xx_exit(void)
1307{
1308 usb_deregister(&smsc95xx_driver);
1309}
1310module_exit(smsc95xx_exit);
1311 1301
1312MODULE_AUTHOR("Nancy Lin"); 1302MODULE_AUTHOR("Nancy Lin");
1313MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>"); 1303MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>");
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index 1a2234c20514..f701d4127087 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -362,17 +362,7 @@ static struct usb_driver zaurus_driver = {
362 .resume = usbnet_resume, 362 .resume = usbnet_resume,
363}; 363};
364 364
365static int __init zaurus_init(void) 365module_usb_driver(zaurus_driver);
366{
367 return usb_register(&zaurus_driver);
368}
369module_init(zaurus_init);
370
371static void __exit zaurus_exit(void)
372{
373 usb_deregister(&zaurus_driver);
374}
375module_exit(zaurus_exit);
376 366
377MODULE_AUTHOR("Pavel Machek, David Brownell"); 367MODULE_AUTHOR("Pavel Machek, David Brownell");
378MODULE_DESCRIPTION("Sharp Zaurus PDA, and compatible products"); 368MODULE_DESCRIPTION("Sharp Zaurus PDA, and compatible products");
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c
index 333b69ef2ae2..89821e4835c7 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -1161,15 +1161,4 @@ static struct usb_driver carl9170_driver = {
1161#endif /* CONFIG_PM */ 1161#endif /* CONFIG_PM */
1162}; 1162};
1163 1163
1164static int __init carl9170_usb_init(void) 1164module_usb_driver(carl9170_driver);
1165{
1166 return usb_register(&carl9170_driver);
1167}
1168
1169static void __exit carl9170_usb_exit(void)
1170{
1171 usb_deregister(&carl9170_driver);
1172}
1173
1174module_init(carl9170_usb_init);
1175module_exit(carl9170_usb_exit);
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index db879c364ebf..b5fbbc7947df 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -1184,29 +1184,7 @@ static struct usb_driver if_usb_driver = {
1184 .reset_resume = if_usb_resume, 1184 .reset_resume = if_usb_resume,
1185}; 1185};
1186 1186
1187static int __init if_usb_init_module(void) 1187module_usb_driver(if_usb_driver);
1188{
1189 int ret = 0;
1190
1191 lbs_deb_enter(LBS_DEB_MAIN);
1192
1193 ret = usb_register(&if_usb_driver);
1194
1195 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1196 return ret;
1197}
1198
1199static void __exit if_usb_exit_module(void)
1200{
1201 lbs_deb_enter(LBS_DEB_MAIN);
1202
1203 usb_deregister(&if_usb_driver);
1204
1205 lbs_deb_leave(LBS_DEB_MAIN);
1206}
1207
1208module_init(if_usb_init_module);
1209module_exit(if_usb_exit_module);
1210 1188
1211MODULE_DESCRIPTION("8388 USB WLAN Driver"); 1189MODULE_DESCRIPTION("8388 USB WLAN Driver");
1212MODULE_AUTHOR("Marvell International Ltd. and Red Hat, Inc."); 1190MODULE_AUTHOR("Marvell International Ltd. and Red Hat, Inc.");
diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c
index 68202e63873a..aff8b5743af0 100644
--- a/drivers/net/wireless/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/libertas_tf/if_usb.c
@@ -924,27 +924,7 @@ static struct usb_driver if_usb_driver = {
924 .resume = if_usb_resume, 924 .resume = if_usb_resume,
925}; 925};
926 926
927static int __init if_usb_init_module(void) 927module_usb_driver(if_usb_driver);
928{
929 int ret = 0;
930
931 lbtf_deb_enter(LBTF_DEB_MAIN);
932
933 ret = usb_register(&if_usb_driver);
934
935 lbtf_deb_leave_args(LBTF_DEB_MAIN, "ret %d", ret);
936 return ret;
937}
938
939static void __exit if_usb_exit_module(void)
940{
941 lbtf_deb_enter(LBTF_DEB_MAIN);
942 usb_deregister(&if_usb_driver);
943 lbtf_deb_leave(LBTF_DEB_MAIN);
944}
945
946module_init(if_usb_init_module);
947module_exit(if_usb_exit_module);
948 928
949MODULE_DESCRIPTION("8388 USB WLAN Thinfirm Driver"); 929MODULE_DESCRIPTION("8388 USB WLAN Thinfirm Driver");
950MODULE_AUTHOR("Cozybit Inc."); 930MODULE_AUTHOR("Cozybit Inc.");
diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c
index 0793e4265b43..ae8ce56670b6 100644
--- a/drivers/net/wireless/orinoco/orinoco_usb.c
+++ b/drivers/net/wireless/orinoco/orinoco_usb.c
@@ -1759,32 +1759,7 @@ static struct usb_driver orinoco_driver = {
1759static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION 1759static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
1760 " (Manuel Estrada Sainz)"; 1760 " (Manuel Estrada Sainz)";
1761 1761
1762static int __init ezusb_module_init(void) 1762module_usb_driver(orinoco_driver);
1763{
1764 int err;
1765
1766 printk(KERN_DEBUG "%s\n", version);
1767
1768 /* register this driver with the USB subsystem */
1769 err = usb_register(&orinoco_driver);
1770 if (err < 0) {
1771 printk(KERN_ERR PFX "usb_register failed, error %d\n",
1772 err);
1773 return err;
1774 }
1775
1776 return 0;
1777}
1778
1779static void __exit ezusb_module_exit(void)
1780{
1781 /* deregister this driver with the USB subsystem */
1782 usb_deregister(&orinoco_driver);
1783}
1784
1785
1786module_init(ezusb_module_init);
1787module_exit(ezusb_module_exit);
1788 1763
1789MODULE_AUTHOR("Manuel Estrada Sainz"); 1764MODULE_AUTHOR("Manuel Estrada Sainz");
1790MODULE_DESCRIPTION("Driver for Orinoco wireless LAN cards using EZUSB bridge"); 1765MODULE_DESCRIPTION("Driver for Orinoco wireless LAN cards using EZUSB bridge");
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 9b6096866427..f4d28c39aac7 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -1083,15 +1083,4 @@ static struct usb_driver p54u_driver = {
1083 .soft_unbind = 1, 1083 .soft_unbind = 1,
1084}; 1084};
1085 1085
1086static int __init p54u_init(void) 1086module_usb_driver(p54u_driver);
1087{
1088 return usb_register(&p54u_driver);
1089}
1090
1091static void __exit p54u_exit(void)
1092{
1093 usb_deregister(&p54u_driver);
1094}
1095
1096module_init(p54u_init);
1097module_exit(p54u_exit);
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 0c13840a7de5..85370a7dfa8b 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -3754,17 +3754,7 @@ static struct usb_driver rndis_wlan_driver = {
3754 .resume = usbnet_resume, 3754 .resume = usbnet_resume,
3755}; 3755};
3756 3756
3757static int __init rndis_wlan_init(void) 3757module_usb_driver(rndis_wlan_driver);
3758{
3759 return usb_register(&rndis_wlan_driver);
3760}
3761module_init(rndis_wlan_init);
3762
3763static void __exit rndis_wlan_exit(void)
3764{
3765 usb_deregister(&rndis_wlan_driver);
3766}
3767module_exit(rndis_wlan_exit);
3768 3758
3769MODULE_AUTHOR("Bjorge Dijkstra"); 3759MODULE_AUTHOR("Bjorge Dijkstra");
3770MODULE_AUTHOR("Jussi Kivilinna"); 3760MODULE_AUTHOR("Jussi Kivilinna");
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 53c5f878f61d..b31f38d41a47 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1982,15 +1982,4 @@ static struct usb_driver rt2500usb_driver = {
1982 .resume = rt2x00usb_resume, 1982 .resume = rt2x00usb_resume,
1983}; 1983};
1984 1984
1985static int __init rt2500usb_init(void) 1985module_usb_driver(rt2500usb_driver);
1986{
1987 return usb_register(&rt2500usb_driver);
1988}
1989
1990static void __exit rt2500usb_exit(void)
1991{
1992 usb_deregister(&rt2500usb_driver);
1993}
1994
1995module_init(rt2500usb_init);
1996module_exit(rt2500usb_exit);
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 377876315b8d..9ea4ecb3d9c8 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1234,15 +1234,4 @@ static struct usb_driver rt2800usb_driver = {
1234 .resume = rt2x00usb_resume, 1234 .resume = rt2x00usb_resume,
1235}; 1235};
1236 1236
1237static int __init rt2800usb_init(void) 1237module_usb_driver(rt2800usb_driver);
1238{
1239 return usb_register(&rt2800usb_driver);
1240}
1241
1242static void __exit rt2800usb_exit(void)
1243{
1244 usb_deregister(&rt2800usb_driver);
1245}
1246
1247module_init(rt2800usb_init);
1248module_exit(rt2800usb_exit);
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index cfb19dbb0a67..0e5a10179182 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2528,15 +2528,4 @@ static struct usb_driver rt73usb_driver = {
2528 .resume = rt2x00usb_resume, 2528 .resume = rt2x00usb_resume,
2529}; 2529};
2530 2530
2531static int __init rt73usb_init(void) 2531module_usb_driver(rt73usb_driver);
2532{
2533 return usb_register(&rt73usb_driver);
2534}
2535
2536static void __exit rt73usb_exit(void)
2537{
2538 usb_deregister(&rt73usb_driver);
2539}
2540
2541module_init(rt73usb_init);
2542module_exit(rt73usb_exit);
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
index 4a78f9e39dfa..638fbef693e6 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
@@ -1592,15 +1592,4 @@ static struct usb_driver rtl8187_driver = {
1592 .disconnect = __devexit_p(rtl8187_disconnect), 1592 .disconnect = __devexit_p(rtl8187_disconnect),
1593}; 1593};
1594 1594
1595static int __init rtl8187_init(void) 1595module_usb_driver(rtl8187_driver);
1596{
1597 return usb_register(&rtl8187_driver);
1598}
1599
1600static void __exit rtl8187_exit(void)
1601{
1602 usb_deregister(&rtl8187_driver);
1603}
1604
1605module_init(rtl8187_init);
1606module_exit(rtl8187_exit);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index c244f2f1b83f..674cd1a486c5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -356,15 +356,4 @@ static struct usb_driver rtl8192cu_driver = {
356#endif 356#endif
357}; 357};
358 358
359static int __init rtl8192cu_init(void) 359module_usb_driver(rtl8192cu_driver);
360{
361 return usb_register(&rtl8192cu_driver);
362}
363
364static void __exit rtl8192cu_exit(void)
365{
366 usb_deregister(&rtl8192cu_driver);
367}
368
369module_init(rtl8192cu_init);
370module_exit(rtl8192cu_exit);
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index 8efa2f2d9579..a66b93b7ff9a 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -1907,15 +1907,4 @@ static struct usb_driver zd1201_usb = {
1907 .resume = zd1201_resume, 1907 .resume = zd1201_resume,
1908}; 1908};
1909 1909
1910static int __init zd1201_init(void) 1910module_usb_driver(zd1201_usb);
1911{
1912 return usb_register(&zd1201_usb);
1913}
1914
1915static void __exit zd1201_cleanup(void)
1916{
1917 usb_deregister(&zd1201_usb);
1918}
1919
1920module_init(zd1201_init);
1921module_exit(zd1201_cleanup);
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 7bcb1febef0d..bd023847efb2 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -1597,24 +1597,7 @@ static struct usb_driver pn533_driver = {
1597 .id_table = pn533_table, 1597 .id_table = pn533_table,
1598}; 1598};
1599 1599
1600static int __init pn533_init(void) 1600module_usb_driver(pn533_driver);
1601{
1602 int rc;
1603
1604 rc = usb_register(&pn533_driver);
1605 if (rc)
1606 err("usb_register failed. Error number %d", rc);
1607
1608 return rc;
1609}
1610
1611static void __exit pn533_exit(void)
1612{
1613 usb_deregister(&pn533_driver);
1614}
1615
1616module_init(pn533_init);
1617module_exit(pn533_exit);
1618 1601
1619MODULE_AUTHOR("Lauro Ramos Venancio <lauro.venancio@openbossa.org>," 1602MODULE_AUTHOR("Lauro Ramos Venancio <lauro.venancio@openbossa.org>,"
1620 " Aloisio Almeida Jr <aloisio.almeida@openbossa.org>"); 1603 " Aloisio Almeida Jr <aloisio.almeida@openbossa.org>");
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 811d436cd677..42a7d603c870 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -28,7 +28,6 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/sysdev.h>
32#include <linux/dmi.h> 31#include <linux/dmi.h>
33#include <linux/efi.h> 32#include <linux/efi.h>
34#include <linux/mutex.h> 33#include <linux/mutex.h>
@@ -165,22 +164,22 @@ static int ibm_rtl_write(u8 value)
165 return ret; 164 return ret;
166} 165}
167 166
168static ssize_t rtl_show_version(struct sysdev_class * dev, 167static ssize_t rtl_show_version(struct device *dev,
169 struct sysdev_class_attribute *attr, 168 struct device_attribute *attr,
170 char *buf) 169 char *buf)
171{ 170{
172 return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version)); 171 return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version));
173} 172}
174 173
175static ssize_t rtl_show_state(struct sysdev_class *dev, 174static ssize_t rtl_show_state(struct device *dev,
176 struct sysdev_class_attribute *attr, 175 struct device_attribute *attr,
177 char *buf) 176 char *buf)
178{ 177{
179 return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status)); 178 return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status));
180} 179}
181 180
182static ssize_t rtl_set_state(struct sysdev_class *dev, 181static ssize_t rtl_set_state(struct device *dev,
183 struct sysdev_class_attribute *attr, 182 struct device_attribute *attr,
184 const char *buf, 183 const char *buf,
185 size_t count) 184 size_t count)
186{ 185{
@@ -205,27 +204,28 @@ static ssize_t rtl_set_state(struct sysdev_class *dev,
205 return ret; 204 return ret;
206} 205}
207 206
208static struct sysdev_class class_rtl = { 207static struct bus_type rtl_subsys = {
209 .name = "ibm_rtl", 208 .name = "ibm_rtl",
209 .dev_name = "ibm_rtl",
210}; 210};
211 211
212static SYSDEV_CLASS_ATTR(version, S_IRUGO, rtl_show_version, NULL); 212static DEVICE_ATTR(version, S_IRUGO, rtl_show_version, NULL);
213static SYSDEV_CLASS_ATTR(state, 0600, rtl_show_state, rtl_set_state); 213static DEVICE_ATTR(state, 0600, rtl_show_state, rtl_set_state);
214 214
215static struct sysdev_class_attribute *rtl_attributes[] = { 215static struct device_attribute *rtl_attributes[] = {
216 &attr_version, 216 &dev_attr_version,
217 &attr_state, 217 &dev_attr_state,
218 NULL 218 NULL
219}; 219};
220 220
221 221
222static int rtl_setup_sysfs(void) { 222static int rtl_setup_sysfs(void) {
223 int ret, i; 223 int ret, i;
224 ret = sysdev_class_register(&class_rtl);
225 224
225 ret = subsys_system_register(&rtl_subsys, NULL);
226 if (!ret) { 226 if (!ret) {
227 for (i = 0; rtl_attributes[i]; i ++) 227 for (i = 0; rtl_attributes[i]; i ++)
228 sysdev_class_create_file(&class_rtl, rtl_attributes[i]); 228 device_create_file(rtl_subsys.dev_root, rtl_attributes[i]);
229 } 229 }
230 return ret; 230 return ret;
231} 231}
@@ -233,8 +233,8 @@ static int rtl_setup_sysfs(void) {
233static void rtl_teardown_sysfs(void) { 233static void rtl_teardown_sysfs(void) {
234 int i; 234 int i;
235 for (i = 0; rtl_attributes[i]; i ++) 235 for (i = 0; rtl_attributes[i]; i ++)
236 sysdev_class_remove_file(&class_rtl, rtl_attributes[i]); 236 device_remove_file(rtl_subsys.dev_root, rtl_attributes[i]);
237 sysdev_class_unregister(&class_rtl); 237 bus_unregister(&rtl_subsys);
238} 238}
239 239
240 240
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index 48870e504231..f00d0d1e0653 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -19,7 +19,7 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/sysdev.h> 22#include <linux/device.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 98f3e4ade924..690c3338a8ae 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -36,7 +36,7 @@
36#include <linux/blkdev.h> 36#include <linux/blkdev.h>
37#include <linux/blkpg.h> 37#include <linux/blkpg.h>
38#include <linux/hdreg.h> /* HDIO_GETGEO */ 38#include <linux/hdreg.h> /* HDIO_GETGEO */
39#include <linux/sysdev.h> 39#include <linux/device.h>
40#include <linux/bio.h> 40#include <linux/bio.h>
41#include <linux/suspend.h> 41#include <linux/suspend.h>
42#include <linux/platform_device.h> 42#include <linux/platform_device.h>
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c
index 95b909ac2b73..3c03c1060be6 100644
--- a/drivers/s390/char/sclp_config.c
+++ b/drivers/s390/char/sclp_config.c
@@ -11,7 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/cpu.h> 13#include <linux/cpu.h>
14#include <linux/sysdev.h> 14#include <linux/device.h>
15#include <linux/workqueue.h> 15#include <linux/workqueue.h>
16#include <asm/smp.h> 16#include <asm/smp.h>
17 17
@@ -31,14 +31,14 @@ static struct work_struct sclp_cpu_change_work;
31static void sclp_cpu_capability_notify(struct work_struct *work) 31static void sclp_cpu_capability_notify(struct work_struct *work)
32{ 32{
33 int cpu; 33 int cpu;
34 struct sys_device *sysdev; 34 struct device *dev;
35 35
36 s390_adjust_jiffies(); 36 s390_adjust_jiffies();
37 pr_warning("cpu capability changed.\n"); 37 pr_warning("cpu capability changed.\n");
38 get_online_cpus(); 38 get_online_cpus();
39 for_each_online_cpu(cpu) { 39 for_each_online_cpu(cpu) {
40 sysdev = get_cpu_sysdev(cpu); 40 dev = get_cpu_device(cpu);
41 kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); 41 kobject_uevent(&dev->kobj, KOBJ_CHANGE);
42 } 42 }
43 put_online_cpus(); 43 put_online_cpus();
44} 44}
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 8b7a141ff35e..e85512dd9c72 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -25,7 +25,7 @@
25#include <linux/stat.h> 25#include <linux/stat.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/sh_intc.h> 27#include <linux/sh_intc.h>
28#include <linux/sysdev.h> 28#include <linux/device.h>
29#include <linux/syscore_ops.h> 29#include <linux/syscore_ops.h>
30#include <linux/list.h> 30#include <linux/list.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
@@ -434,46 +434,47 @@ struct syscore_ops intc_syscore_ops = {
434 .resume = intc_resume, 434 .resume = intc_resume,
435}; 435};
436 436
437struct sysdev_class intc_sysdev_class = { 437struct bus_type intc_subsys = {
438 .name = "intc", 438 .name = "intc",
439 .dev_name = "intc",
439}; 440};
440 441
441static ssize_t 442static ssize_t
442show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) 443show_intc_name(struct device *dev, struct device_attribute *attr, char *buf)
443{ 444{
444 struct intc_desc_int *d; 445 struct intc_desc_int *d;
445 446
446 d = container_of(dev, struct intc_desc_int, sysdev); 447 d = container_of(dev, struct intc_desc_int, dev);
447 448
448 return sprintf(buf, "%s\n", d->chip.name); 449 return sprintf(buf, "%s\n", d->chip.name);
449} 450}
450 451
451static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL); 452static DEVICE_ATTR(name, S_IRUGO, show_intc_name, NULL);
452 453
453static int __init register_intc_sysdevs(void) 454static int __init register_intc_devs(void)
454{ 455{
455 struct intc_desc_int *d; 456 struct intc_desc_int *d;
456 int error; 457 int error;
457 458
458 register_syscore_ops(&intc_syscore_ops); 459 register_syscore_ops(&intc_syscore_ops);
459 460
460 error = sysdev_class_register(&intc_sysdev_class); 461 error = subsys_system_register(&intc_subsys, NULL);
461 if (!error) { 462 if (!error) {
462 list_for_each_entry(d, &intc_list, list) { 463 list_for_each_entry(d, &intc_list, list) {
463 d->sysdev.id = d->index; 464 d->dev.id = d->index;
464 d->sysdev.cls = &intc_sysdev_class; 465 d->dev.bus = &intc_subsys;
465 error = sysdev_register(&d->sysdev); 466 error = device_register(&d->dev);
466 if (error == 0) 467 if (error == 0)
467 error = sysdev_create_file(&d->sysdev, 468 error = device_create_file(&d->dev,
468 &attr_name); 469 &dev_attr_name);
469 if (error) 470 if (error)
470 break; 471 break;
471 } 472 }
472 } 473 }
473 474
474 if (error) 475 if (error)
475 pr_err("sysdev registration error\n"); 476 pr_err("device registration error\n");
476 477
477 return error; 478 return error;
478} 479}
479device_initcall(register_intc_sysdevs); 480device_initcall(register_intc_devs);
diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
index 5b934851efa8..1c2722e5af3f 100644
--- a/drivers/sh/intc/internals.h
+++ b/drivers/sh/intc/internals.h
@@ -4,7 +4,7 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/radix-tree.h> 6#include <linux/radix-tree.h>
7#include <linux/sysdev.h> 7#include <linux/device.h>
8 8
9#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ 9#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
10 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ 10 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
@@ -51,7 +51,7 @@ struct intc_subgroup_entry {
51 51
52struct intc_desc_int { 52struct intc_desc_int {
53 struct list_head list; 53 struct list_head list;
54 struct sys_device sysdev; 54 struct device dev;
55 struct radix_tree_root tree; 55 struct radix_tree_root tree;
56 raw_spinlock_t lock; 56 raw_spinlock_t lock;
57 unsigned int index; 57 unsigned int index;
@@ -157,7 +157,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle);
157extern struct list_head intc_list; 157extern struct list_head intc_list;
158extern raw_spinlock_t intc_big_lock; 158extern raw_spinlock_t intc_big_lock;
159extern unsigned int nr_intc_controllers; 159extern unsigned int nr_intc_controllers;
160extern struct sysdev_class intc_sysdev_class; 160extern struct bus_type intc_subsys;
161 161
162unsigned int intc_get_dfl_prio_level(void); 162unsigned int intc_get_dfl_prio_level(void);
163unsigned int intc_get_prio_level(unsigned int irq); 163unsigned int intc_get_prio_level(unsigned int irq);
diff --git a/drivers/sh/intc/userimask.c b/drivers/sh/intc/userimask.c
index 56bf9336b92b..e649ceaaa410 100644
--- a/drivers/sh/intc/userimask.c
+++ b/drivers/sh/intc/userimask.c
@@ -10,7 +10,7 @@
10#define pr_fmt(fmt) "intc: " fmt 10#define pr_fmt(fmt) "intc: " fmt
11 11
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/sysdev.h> 13#include <linux/device.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/stat.h> 16#include <linux/stat.h>
@@ -20,15 +20,15 @@
20static void __iomem *uimask; 20static void __iomem *uimask;
21 21
22static ssize_t 22static ssize_t
23show_intc_userimask(struct sysdev_class *cls, 23show_intc_userimask(struct device *dev,
24 struct sysdev_class_attribute *attr, char *buf) 24 struct device_attribute *attr, char *buf)
25{ 25{
26 return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf); 26 return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf);
27} 27}
28 28
29static ssize_t 29static ssize_t
30store_intc_userimask(struct sysdev_class *cls, 30store_intc_userimask(struct device *dev,
31 struct sysdev_class_attribute *attr, 31 struct device_attribute *attr,
32 const char *buf, size_t count) 32 const char *buf, size_t count)
33{ 33{
34 unsigned long level; 34 unsigned long level;
@@ -55,8 +55,8 @@ store_intc_userimask(struct sysdev_class *cls,
55 return count; 55 return count;
56} 56}
57 57
58static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR, 58static DEVICE_ATTR(userimask, S_IRUSR | S_IWUSR,
59 show_intc_userimask, store_intc_userimask); 59 show_intc_userimask, store_intc_userimask);
60 60
61 61
62static int __init userimask_sysdev_init(void) 62static int __init userimask_sysdev_init(void)
@@ -64,7 +64,7 @@ static int __init userimask_sysdev_init(void)
64 if (unlikely(!uimask)) 64 if (unlikely(!uimask))
65 return -ENXIO; 65 return -ENXIO;
66 66
67 return sysdev_class_create_file(&intc_sysdev_class, &attr_userimask); 67 return device_create_file(intc_subsys.dev_root, &dev_attr_userimask);
68} 68}
69late_initcall(userimask_sysdev_init); 69late_initcall(userimask_sysdev_init);
70 70
diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c
index 2babb034a254..d8efed657440 100644
--- a/drivers/staging/frontier/alphatrack.c
+++ b/drivers/staging/frontier/alphatrack.c
@@ -867,30 +867,4 @@ static struct usb_driver usb_alphatrack_driver = {
867 .id_table = usb_alphatrack_table, 867 .id_table = usb_alphatrack_table,
868}; 868};
869 869
870/** 870module_usb_driver(usb_alphatrack_driver);
871 * usb_alphatrack_init
872 */
873static int __init usb_alphatrack_init(void)
874{
875 int retval;
876
877 /* register this driver with the USB subsystem */
878 retval = usb_register(&usb_alphatrack_driver);
879 if (retval)
880 err("usb_register failed for the " __FILE__
881 " driver. Error number %d\n", retval);
882
883 return retval;
884}
885
886/**
887 * usb_alphatrack_exit
888 */
889static void __exit usb_alphatrack_exit(void)
890{
891 /* deregister this driver with the USB subsystem */
892 usb_deregister(&usb_alphatrack_driver);
893}
894
895module_init(usb_alphatrack_init);
896module_exit(usb_alphatrack_exit);
diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c
index 8894ab14f167..c263284ddc0e 100644
--- a/drivers/staging/frontier/tranzport.c
+++ b/drivers/staging/frontier/tranzport.c
@@ -971,29 +971,4 @@ static struct usb_driver usb_tranzport_driver = {
971 .id_table = usb_tranzport_table, 971 .id_table = usb_tranzport_table,
972}; 972};
973 973
974/** 974module_usb_driver(usb_tranzport_driver);
975 * usb_tranzport_init
976 */
977static int __init usb_tranzport_init(void)
978{
979 int retval;
980
981 /* register this driver with the USB subsystem */
982 retval = usb_register(&usb_tranzport_driver);
983 if (retval)
984 err("usb_register failed for the " __FILE__
985 " driver. Error number %d\n", retval);
986 return retval;
987}
988/**
989 * usb_tranzport_exit
990 */
991
992static void __exit usb_tranzport_exit(void)
993{
994 /* deregister this driver with the USB subsystem */
995 usb_deregister(&usb_tranzport_driver);
996}
997
998module_init(usb_tranzport_init);
999module_exit(usb_tranzport_exit);
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
index 79482ac1c489..84c38d5c9397 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
@@ -263,24 +263,4 @@ static struct usb_driver ft1000_usb_driver = {
263 .id_table = id_table, 263 .id_table = id_table,
264}; 264};
265 265
266static int __init usb_ft1000_init(void) 266module_usb_driver(ft1000_usb_driver);
267{
268 int ret = 0;
269
270 DEBUG("Initialize and register the driver\n");
271
272 ret = usb_register(&ft1000_usb_driver);
273 if (ret)
274 err("usb_register failed. Error number %d", ret);
275
276 return ret;
277}
278
279static void __exit usb_ft1000_exit(void)
280{
281 DEBUG("Deregister the driver\n");
282 usb_deregister(&ft1000_usb_driver);
283}
284
285module_init(usb_ft1000_init);
286module_exit(usb_ft1000_exit);
diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c
index 1c5dad537844..97f747eac647 100644
--- a/drivers/staging/iio/accel/adis16201_core.c
+++ b/drivers/staging/iio/accel/adis16201_core.c
@@ -549,18 +549,7 @@ static struct spi_driver adis16201_driver = {
549 .probe = adis16201_probe, 549 .probe = adis16201_probe,
550 .remove = __devexit_p(adis16201_remove), 550 .remove = __devexit_p(adis16201_remove),
551}; 551};
552 552module_spi_driver(adis16201_driver);
553static __init int adis16201_init(void)
554{
555 return spi_register_driver(&adis16201_driver);
556}
557module_init(adis16201_init);
558
559static __exit void adis16201_exit(void)
560{
561 spi_unregister_driver(&adis16201_driver);
562}
563module_exit(adis16201_exit);
564 553
565MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 554MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
566MODULE_DESCRIPTION("Analog Devices ADIS16201 Programmable Digital Vibration Sensor driver"); 555MODULE_DESCRIPTION("Analog Devices ADIS16201 Programmable Digital Vibration Sensor driver");
diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c
index 8a3337442afd..a6d6d27f3c97 100644
--- a/drivers/staging/iio/accel/adis16203_core.c
+++ b/drivers/staging/iio/accel/adis16203_core.c
@@ -504,18 +504,7 @@ static struct spi_driver adis16203_driver = {
504 .probe = adis16203_probe, 504 .probe = adis16203_probe,
505 .remove = __devexit_p(adis16203_remove), 505 .remove = __devexit_p(adis16203_remove),
506}; 506};
507 507module_spi_driver(adis16203_driver);
508static __init int adis16203_init(void)
509{
510 return spi_register_driver(&adis16203_driver);
511}
512module_init(adis16203_init);
513
514static __exit void adis16203_exit(void)
515{
516 spi_unregister_driver(&adis16203_driver);
517}
518module_exit(adis16203_exit);
519 508
520MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 509MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
521MODULE_DESCRIPTION("Analog Devices ADIS16203 Programmable Digital Vibration Sensor driver"); 510MODULE_DESCRIPTION("Analog Devices ADIS16203 Programmable Digital Vibration Sensor driver");
diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c
index 644ac8e4d2aa..7ac5b4c533d8 100644
--- a/drivers/staging/iio/accel/adis16204_core.c
+++ b/drivers/staging/iio/accel/adis16204_core.c
@@ -577,18 +577,7 @@ static struct spi_driver adis16204_driver = {
577 .probe = adis16204_probe, 577 .probe = adis16204_probe,
578 .remove = __devexit_p(adis16204_remove), 578 .remove = __devexit_p(adis16204_remove),
579}; 579};
580 580module_spi_driver(adis16204_driver);
581static __init int adis16204_init(void)
582{
583 return spi_register_driver(&adis16204_driver);
584}
585module_init(adis16204_init);
586
587static __exit void adis16204_exit(void)
588{
589 spi_unregister_driver(&adis16204_driver);
590}
591module_exit(adis16204_exit);
592 581
593MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 582MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
594MODULE_DESCRIPTION("ADIS16204 High-g Digital Impact Sensor and Recorder"); 583MODULE_DESCRIPTION("ADIS16204 High-g Digital Impact Sensor and Recorder");
diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c
index 0a8571b18b39..c03afbf5bbdc 100644
--- a/drivers/staging/iio/accel/adis16209_core.c
+++ b/drivers/staging/iio/accel/adis16209_core.c
@@ -553,18 +553,7 @@ static struct spi_driver adis16209_driver = {
553 .probe = adis16209_probe, 553 .probe = adis16209_probe,
554 .remove = __devexit_p(adis16209_remove), 554 .remove = __devexit_p(adis16209_remove),
555}; 555};
556 556module_spi_driver(adis16209_driver);
557static __init int adis16209_init(void)
558{
559 return spi_register_driver(&adis16209_driver);
560}
561module_init(adis16209_init);
562
563static __exit void adis16209_exit(void)
564{
565 spi_unregister_driver(&adis16209_driver);
566}
567module_exit(adis16209_exit);
568 557
569MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 558MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
570MODULE_DESCRIPTION("Analog Devices ADIS16209 Digital Vibration Sensor driver"); 559MODULE_DESCRIPTION("Analog Devices ADIS16209 Digital Vibration Sensor driver");
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c
index 6d4503de192d..73298e7849e6 100644
--- a/drivers/staging/iio/accel/adis16220_core.c
+++ b/drivers/staging/iio/accel/adis16220_core.c
@@ -708,18 +708,7 @@ static struct spi_driver adis16220_driver = {
708 .probe = adis16220_probe, 708 .probe = adis16220_probe,
709 .remove = __devexit_p(adis16220_remove), 709 .remove = __devexit_p(adis16220_remove),
710}; 710};
711 711module_spi_driver(adis16220_driver);
712static __init int adis16220_init(void)
713{
714 return spi_register_driver(&adis16220_driver);
715}
716module_init(adis16220_init);
717
718static __exit void adis16220_exit(void)
719{
720 spi_unregister_driver(&adis16220_driver);
721}
722module_exit(adis16220_exit);
723 712
724MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 713MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
725MODULE_DESCRIPTION("Analog Devices ADIS16220 Digital Vibration Sensor"); 714MODULE_DESCRIPTION("Analog Devices ADIS16220 Digital Vibration Sensor");
diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c
index b8be2925d61c..88881b9919ef 100644
--- a/drivers/staging/iio/accel/adis16240_core.c
+++ b/drivers/staging/iio/accel/adis16240_core.c
@@ -606,18 +606,7 @@ static struct spi_driver adis16240_driver = {
606 .probe = adis16240_probe, 606 .probe = adis16240_probe,
607 .remove = __devexit_p(adis16240_remove), 607 .remove = __devexit_p(adis16240_remove),
608}; 608};
609 609module_spi_driver(adis16240_driver);
610static __init int adis16240_init(void)
611{
612 return spi_register_driver(&adis16240_driver);
613}
614module_init(adis16240_init);
615
616static __exit void adis16240_exit(void)
617{
618 spi_unregister_driver(&adis16240_driver);
619}
620module_exit(adis16240_exit);
621 610
622MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 611MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
623MODULE_DESCRIPTION("Analog Devices Programmable Impact Sensor and Recorder"); 612MODULE_DESCRIPTION("Analog Devices Programmable Impact Sensor and Recorder");
diff --git a/drivers/staging/iio/accel/kxsd9.c b/drivers/staging/iio/accel/kxsd9.c
index 5238503f6805..cfce21c2eddc 100644
--- a/drivers/staging/iio/accel/kxsd9.c
+++ b/drivers/staging/iio/accel/kxsd9.c
@@ -280,18 +280,7 @@ static struct spi_driver kxsd9_driver = {
280 .remove = __devexit_p(kxsd9_remove), 280 .remove = __devexit_p(kxsd9_remove),
281 .id_table = kxsd9_id, 281 .id_table = kxsd9_id,
282}; 282};
283 283module_spi_driver(kxsd9_driver);
284static __init int kxsd9_spi_init(void)
285{
286 return spi_register_driver(&kxsd9_driver);
287}
288module_init(kxsd9_spi_init);
289
290static __exit void kxsd9_spi_exit(void)
291{
292 spi_unregister_driver(&kxsd9_driver);
293}
294module_exit(kxsd9_spi_exit);
295 284
296MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>"); 285MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>");
297MODULE_DESCRIPTION("Kionix KXSD9 SPI driver"); 286MODULE_DESCRIPTION("Kionix KXSD9 SPI driver");
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c
index 559545a42333..6877521ec173 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -804,18 +804,7 @@ static struct spi_driver lis3l02dq_driver = {
804 .probe = lis3l02dq_probe, 804 .probe = lis3l02dq_probe,
805 .remove = __devexit_p(lis3l02dq_remove), 805 .remove = __devexit_p(lis3l02dq_remove),
806}; 806};
807 807module_spi_driver(lis3l02dq_driver);
808static __init int lis3l02dq_init(void)
809{
810 return spi_register_driver(&lis3l02dq_driver);
811}
812module_init(lis3l02dq_init);
813
814static __exit void lis3l02dq_exit(void)
815{
816 spi_unregister_driver(&lis3l02dq_driver);
817}
818module_exit(lis3l02dq_exit);
819 808
820MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>"); 809MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>");
821MODULE_DESCRIPTION("ST LIS3L02DQ Accelerometer SPI driver"); 810MODULE_DESCRIPTION("ST LIS3L02DQ Accelerometer SPI driver");
diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c
index a44a70589db9..6c359074a06d 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -1250,18 +1250,7 @@ static struct spi_driver sca3000_driver = {
1250 .remove = __devexit_p(sca3000_remove), 1250 .remove = __devexit_p(sca3000_remove),
1251 .id_table = sca3000_id, 1251 .id_table = sca3000_id,
1252}; 1252};
1253 1253module_spi_driver(sca3000_driver);
1254static __init int sca3000_init(void)
1255{
1256 return spi_register_driver(&sca3000_driver);
1257}
1258module_init(sca3000_init);
1259
1260static __exit void sca3000_exit(void)
1261{
1262 spi_unregister_driver(&sca3000_driver);
1263}
1264module_exit(sca3000_exit);
1265 1254
1266MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>"); 1255MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>");
1267MODULE_DESCRIPTION("VTI SCA3000 Series Accelerometers SPI driver"); 1256MODULE_DESCRIPTION("VTI SCA3000 Series Accelerometers SPI driver");
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index 31c376b9d5eb..a6a4a4e1f183 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -1161,18 +1161,7 @@ static struct spi_driver ad7192_driver = {
1161 .remove = __devexit_p(ad7192_remove), 1161 .remove = __devexit_p(ad7192_remove),
1162 .id_table = ad7192_id, 1162 .id_table = ad7192_id,
1163}; 1163};
1164 1164module_spi_driver(ad7192_driver);
1165static int __init ad7192_init(void)
1166{
1167 return spi_register_driver(&ad7192_driver);
1168}
1169module_init(ad7192_init);
1170
1171static void __exit ad7192_exit(void)
1172{
1173 spi_unregister_driver(&ad7192_driver);
1174}
1175module_exit(ad7192_exit);
1176 1165
1177MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 1166MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
1178MODULE_DESCRIPTION("Analog Devices AD7190, AD7192, AD7195 ADC"); 1167MODULE_DESCRIPTION("Analog Devices AD7190, AD7192, AD7195 ADC");
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 372d059042f9..dbaeae81e873 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -979,18 +979,7 @@ static struct spi_driver ad7280_driver = {
979 .remove = __devexit_p(ad7280_remove), 979 .remove = __devexit_p(ad7280_remove),
980 .id_table = ad7280_id, 980 .id_table = ad7280_id,
981}; 981};
982 982module_spi_driver(ad7280_driver);
983static int __init ad7280_init(void)
984{
985 return spi_register_driver(&ad7280_driver);
986}
987module_init(ad7280_init);
988
989static void __exit ad7280_exit(void)
990{
991 spi_unregister_driver(&ad7280_driver);
992}
993module_exit(ad7280_exit);
994 983
995MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 984MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
996MODULE_DESCRIPTION("Analog Devices AD7280A"); 985MODULE_DESCRIPTION("Analog Devices AD7280A");
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index 10e79e8ee64d..aa44a52a7adb 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -700,20 +700,8 @@ static struct i2c_driver ad7291_driver = {
700 .remove = __devexit_p(ad7291_remove), 700 .remove = __devexit_p(ad7291_remove),
701 .id_table = ad7291_id, 701 .id_table = ad7291_id,
702}; 702};
703 703module_i2c_driver(ad7291_driver);
704static __init int ad7291_init(void)
705{
706 return i2c_add_driver(&ad7291_driver);
707}
708
709static __exit void ad7291_exit(void)
710{
711 i2c_del_driver(&ad7291_driver);
712}
713 704
714MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); 705MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
715MODULE_DESCRIPTION("Analog Devices AD7291 ADC driver"); 706MODULE_DESCRIPTION("Analog Devices AD7291 ADC driver");
716MODULE_LICENSE("GPL v2"); 707MODULE_LICENSE("GPL v2");
717
718module_init(ad7291_init);
719module_exit(ad7291_exit);
diff --git a/drivers/staging/iio/adc/ad7298_core.c b/drivers/staging/iio/adc/ad7298_core.c
index c1de73a1ca91..a799bd1922dc 100644
--- a/drivers/staging/iio/adc/ad7298_core.c
+++ b/drivers/staging/iio/adc/ad7298_core.c
@@ -276,18 +276,7 @@ static struct spi_driver ad7298_driver = {
276 .remove = __devexit_p(ad7298_remove), 276 .remove = __devexit_p(ad7298_remove),
277 .id_table = ad7298_id, 277 .id_table = ad7298_id,
278}; 278};
279 279module_spi_driver(ad7298_driver);
280static int __init ad7298_init(void)
281{
282 return spi_register_driver(&ad7298_driver);
283}
284module_init(ad7298_init);
285
286static void __exit ad7298_exit(void)
287{
288 spi_unregister_driver(&ad7298_driver);
289}
290module_exit(ad7298_exit);
291 280
292MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 281MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
293MODULE_DESCRIPTION("Analog Devices AD7298 ADC"); 282MODULE_DESCRIPTION("Analog Devices AD7298 ADC");
diff --git a/drivers/staging/iio/adc/ad7476_core.c b/drivers/staging/iio/adc/ad7476_core.c
index fd79facc6cae..0b5852030ab6 100644
--- a/drivers/staging/iio/adc/ad7476_core.c
+++ b/drivers/staging/iio/adc/ad7476_core.c
@@ -248,18 +248,7 @@ static struct spi_driver ad7476_driver = {
248 .remove = __devexit_p(ad7476_remove), 248 .remove = __devexit_p(ad7476_remove),
249 .id_table = ad7476_id, 249 .id_table = ad7476_id,
250}; 250};
251 251module_spi_driver(ad7476_driver);
252static int __init ad7476_init(void)
253{
254 return spi_register_driver(&ad7476_driver);
255}
256module_init(ad7476_init);
257
258static void __exit ad7476_exit(void)
259{
260 spi_unregister_driver(&ad7476_driver);
261}
262module_exit(ad7476_exit);
263 252
264MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 253MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
265MODULE_DESCRIPTION("Analog Devices AD7475/6/7/8(A) AD7466/7/8 ADC"); 254MODULE_DESCRIPTION("Analog Devices AD7475/6/7/8(A) AD7466/7/8 ADC");
diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c
index aede1ba5e041..b984bd2048b6 100644
--- a/drivers/staging/iio/adc/ad7606_spi.c
+++ b/drivers/staging/iio/adc/ad7606_spi.c
@@ -109,18 +109,7 @@ static struct spi_driver ad7606_driver = {
109 .remove = __devexit_p(ad7606_spi_remove), 109 .remove = __devexit_p(ad7606_spi_remove),
110 .id_table = ad7606_id, 110 .id_table = ad7606_id,
111}; 111};
112 112module_spi_driver(ad7606_driver);
113static int __init ad7606_spi_init(void)
114{
115 return spi_register_driver(&ad7606_driver);
116}
117module_init(ad7606_spi_init);
118
119static void __exit ad7606_spi_exit(void)
120{
121 spi_unregister_driver(&ad7606_driver);
122}
123module_exit(ad7606_spi_exit);
124 113
125MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 114MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
126MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); 115MODULE_DESCRIPTION("Analog Devices AD7606 ADC");
diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
index 7a579a1fd696..ec90261cbc3c 100644
--- a/drivers/staging/iio/adc/ad7780.c
+++ b/drivers/staging/iio/adc/ad7780.c
@@ -283,18 +283,7 @@ static struct spi_driver ad7780_driver = {
283 .remove = __devexit_p(ad7780_remove), 283 .remove = __devexit_p(ad7780_remove),
284 .id_table = ad7780_id, 284 .id_table = ad7780_id,
285}; 285};
286 286module_spi_driver(ad7780_driver);
287static int __init ad7780_init(void)
288{
289 return spi_register_driver(&ad7780_driver);
290}
291module_init(ad7780_init);
292
293static void __exit ad7780_exit(void)
294{
295 spi_unregister_driver(&ad7780_driver);
296}
297module_exit(ad7780_exit);
298 287
299MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 288MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
300MODULE_DESCRIPTION("Analog Devices AD7780/1 ADC"); 289MODULE_DESCRIPTION("Analog Devices AD7780/1 ADC");
diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c
index 999f8f746cff..1c5588e88cdf 100644
--- a/drivers/staging/iio/adc/ad7793.c
+++ b/drivers/staging/iio/adc/ad7793.c
@@ -1045,18 +1045,7 @@ static struct spi_driver ad7793_driver = {
1045 .remove = __devexit_p(ad7793_remove), 1045 .remove = __devexit_p(ad7793_remove),
1046 .id_table = ad7793_id, 1046 .id_table = ad7793_id,
1047}; 1047};
1048 1048module_spi_driver(ad7793_driver);
1049static int __init ad7793_init(void)
1050{
1051 return spi_register_driver(&ad7793_driver);
1052}
1053module_init(ad7793_init);
1054
1055static void __exit ad7793_exit(void)
1056{
1057 spi_unregister_driver(&ad7793_driver);
1058}
1059module_exit(ad7793_exit);
1060 1049
1061MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 1050MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
1062MODULE_DESCRIPTION("Analog Devices AD7792/3 ADC"); 1051MODULE_DESCRIPTION("Analog Devices AD7792/3 ADC");
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index bdb90492b8a5..acbf9363132b 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -466,21 +466,9 @@ static struct spi_driver ad7816_driver = {
466 .remove = __devexit_p(ad7816_remove), 466 .remove = __devexit_p(ad7816_remove),
467 .id_table = ad7816_id, 467 .id_table = ad7816_id,
468}; 468};
469 469module_spi_driver(ad7816_driver);
470static __init int ad7816_init(void)
471{
472 return spi_register_driver(&ad7816_driver);
473}
474
475static __exit void ad7816_exit(void)
476{
477 spi_unregister_driver(&ad7816_driver);
478}
479 470
480MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); 471MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
481MODULE_DESCRIPTION("Analog Devices AD7816/7/8 digital" 472MODULE_DESCRIPTION("Analog Devices AD7816/7/8 digital"
482 " temperature sensor driver"); 473 " temperature sensor driver");
483MODULE_LICENSE("GPL v2"); 474MODULE_LICENSE("GPL v2");
484
485module_init(ad7816_init);
486module_exit(ad7816_exit);
diff --git a/drivers/staging/iio/adc/ad7887_core.c b/drivers/staging/iio/adc/ad7887_core.c
index 609dcd5f2ddc..91b8fb09d92b 100644
--- a/drivers/staging/iio/adc/ad7887_core.c
+++ b/drivers/staging/iio/adc/ad7887_core.c
@@ -257,18 +257,7 @@ static struct spi_driver ad7887_driver = {
257 .remove = __devexit_p(ad7887_remove), 257 .remove = __devexit_p(ad7887_remove),
258 .id_table = ad7887_id, 258 .id_table = ad7887_id,
259}; 259};
260 260module_spi_driver(ad7887_driver);
261static int __init ad7887_init(void)
262{
263 return spi_register_driver(&ad7887_driver);
264}
265module_init(ad7887_init);
266
267static void __exit ad7887_exit(void)
268{
269 spi_unregister_driver(&ad7887_driver);
270}
271module_exit(ad7887_exit);
272 261
273MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 262MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
274MODULE_DESCRIPTION("Analog Devices AD7887 ADC"); 263MODULE_DESCRIPTION("Analog Devices AD7887 ADC");
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
index ee6cd792bec8..c0d2f886ea2c 100644
--- a/drivers/staging/iio/adc/ad799x_core.c
+++ b/drivers/staging/iio/adc/ad799x_core.c
@@ -929,21 +929,9 @@ static struct i2c_driver ad799x_driver = {
929 .remove = __devexit_p(ad799x_remove), 929 .remove = __devexit_p(ad799x_remove),
930 .id_table = ad799x_id, 930 .id_table = ad799x_id,
931}; 931};
932 932module_i2c_driver(ad799x_driver);
933static __init int ad799x_init(void)
934{
935 return i2c_add_driver(&ad799x_driver);
936}
937
938static __exit void ad799x_exit(void)
939{
940 i2c_del_driver(&ad799x_driver);
941}
942 933
943MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 934MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
944MODULE_DESCRIPTION("Analog Devices AD799x ADC"); 935MODULE_DESCRIPTION("Analog Devices AD799x ADC");
945MODULE_LICENSE("GPL v2"); 936MODULE_LICENSE("GPL v2");
946MODULE_ALIAS("i2c:ad799x"); 937MODULE_ALIAS("i2c:ad799x");
947
948module_init(ad799x_init);
949module_exit(ad799x_exit);
diff --git a/drivers/staging/iio/adc/adt7310.c b/drivers/staging/iio/adc/adt7310.c
index c9e0be3b1cf3..bc307f3b024e 100644
--- a/drivers/staging/iio/adc/adt7310.c
+++ b/drivers/staging/iio/adc/adt7310.c
@@ -884,21 +884,9 @@ static struct spi_driver adt7310_driver = {
884 .remove = __devexit_p(adt7310_remove), 884 .remove = __devexit_p(adt7310_remove),
885 .id_table = adt7310_id, 885 .id_table = adt7310_id,
886}; 886};
887 887module_spi_driver(adt7310_driver);
888static __init int adt7310_init(void)
889{
890 return spi_register_driver(&adt7310_driver);
891}
892
893static __exit void adt7310_exit(void)
894{
895 spi_unregister_driver(&adt7310_driver);
896}
897 888
898MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); 889MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
899MODULE_DESCRIPTION("Analog Devices ADT7310 digital" 890MODULE_DESCRIPTION("Analog Devices ADT7310 digital"
900 " temperature sensor driver"); 891 " temperature sensor driver");
901MODULE_LICENSE("GPL v2"); 892MODULE_LICENSE("GPL v2");
902
903module_init(adt7310_init);
904module_exit(adt7310_exit);
diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c
index a289e429dc41..3481cf6f7574 100644
--- a/drivers/staging/iio/adc/adt7410.c
+++ b/drivers/staging/iio/adc/adt7410.c
@@ -844,21 +844,9 @@ static struct i2c_driver adt7410_driver = {
844 .remove = __devexit_p(adt7410_remove), 844 .remove = __devexit_p(adt7410_remove),
845 .id_table = adt7410_id, 845 .id_table = adt7410_id,
846}; 846};
847 847module_i2c_driver(adt7410_driver);
848static __init int adt7410_init(void)
849{
850 return i2c_add_driver(&adt7410_driver);
851}
852
853static __exit void adt7410_exit(void)
854{
855 i2c_del_driver(&adt7410_driver);
856}
857 848
858MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); 849MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
859MODULE_DESCRIPTION("Analog Devices ADT7410 digital" 850MODULE_DESCRIPTION("Analog Devices ADT7410 digital"
860 " temperature sensor driver"); 851 " temperature sensor driver");
861MODULE_LICENSE("GPL v2"); 852MODULE_LICENSE("GPL v2");
862
863module_init(adt7410_init);
864module_exit(adt7410_exit);
diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index eb699ade34b0..3f28f1ab52a2 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -1410,20 +1410,8 @@ static struct i2c_driver max1363_driver = {
1410 .remove = max1363_remove, 1410 .remove = max1363_remove,
1411 .id_table = max1363_id, 1411 .id_table = max1363_id,
1412}; 1412};
1413 1413module_i2c_driver(max1363_driver);
1414static __init int max1363_init(void)
1415{
1416 return i2c_add_driver(&max1363_driver);
1417}
1418
1419static __exit void max1363_exit(void)
1420{
1421 i2c_del_driver(&max1363_driver);
1422}
1423 1414
1424MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>"); 1415MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>");
1425MODULE_DESCRIPTION("Maxim 1363 ADC"); 1416MODULE_DESCRIPTION("Maxim 1363 ADC");
1426MODULE_LICENSE("GPL v2"); 1417MODULE_LICENSE("GPL v2");
1427
1428module_init(max1363_init);
1429module_exit(max1363_exit);
diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c
index 07d718e8fb4d..2c03a39220e8 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -151,21 +151,9 @@ static struct i2c_driver adt7316_driver = {
151 .resume = adt7316_i2c_resume, 151 .resume = adt7316_i2c_resume,
152 .id_table = adt7316_i2c_id, 152 .id_table = adt7316_i2c_id,
153}; 153};
154 154module_i2c_driver(adt7316_driver);
155static __init int adt7316_i2c_init(void)
156{
157 return i2c_add_driver(&adt7316_driver);
158}
159
160static __exit void adt7316_i2c_exit(void)
161{
162 i2c_del_driver(&adt7316_driver);
163}
164 155
165MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); 156MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
166MODULE_DESCRIPTION("I2C bus driver for Analog Devices ADT7316/7/9 and" 157MODULE_DESCRIPTION("I2C bus driver for Analog Devices ADT7316/7/9 and"
167 "ADT7516/7/8 digital temperature sensor, ADC and DAC"); 158 "ADT7516/7/8 digital temperature sensor, ADC and DAC");
168MODULE_LICENSE("GPL v2"); 159MODULE_LICENSE("GPL v2");
169
170module_init(adt7316_i2c_init);
171module_exit(adt7316_i2c_exit);
diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c
index 369d4d01ed97..1e93c7b7aed9 100644
--- a/drivers/staging/iio/addac/adt7316-spi.c
+++ b/drivers/staging/iio/addac/adt7316-spi.c
@@ -160,21 +160,9 @@ static struct spi_driver adt7316_driver = {
160 .resume = adt7316_spi_resume, 160 .resume = adt7316_spi_resume,
161 .id_table = adt7316_spi_id, 161 .id_table = adt7316_spi_id,
162}; 162};
163 163module_spi_driver(adt7316_driver);
164static __init int adt7316_spi_init(void)
165{
166 return spi_register_driver(&adt7316_driver);
167}
168
169static __exit void adt7316_spi_exit(void)
170{
171 spi_unregister_driver(&adt7316_driver);
172}
173 164
174MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); 165MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
175MODULE_DESCRIPTION("SPI bus driver for Analog Devices ADT7316/7/8 and" 166MODULE_DESCRIPTION("SPI bus driver for Analog Devices ADT7316/7/8 and"
176 "ADT7516/7/9 digital temperature sensor, ADC and DAC"); 167 "ADT7516/7/9 digital temperature sensor, ADC and DAC");
177MODULE_LICENSE("GPL v2"); 168MODULE_LICENSE("GPL v2");
178
179module_init(adt7316_spi_init);
180module_exit(adt7316_spi_exit);
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index a761ca94a17e..47181875e113 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -657,20 +657,8 @@ static struct i2c_driver ad7150_driver = {
657 .remove = __devexit_p(ad7150_remove), 657 .remove = __devexit_p(ad7150_remove),
658 .id_table = ad7150_id, 658 .id_table = ad7150_id,
659}; 659};
660 660module_i2c_driver(ad7150_driver);
661static __init int ad7150_init(void)
662{
663 return i2c_add_driver(&ad7150_driver);
664}
665
666static __exit void ad7150_exit(void)
667{
668 i2c_del_driver(&ad7150_driver);
669}
670 661
671MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 662MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
672MODULE_DESCRIPTION("Analog Devices AD7150/1/6 capacitive sensor driver"); 663MODULE_DESCRIPTION("Analog Devices AD7150/1/6 capacitive sensor driver");
673MODULE_LICENSE("GPL v2"); 664MODULE_LICENSE("GPL v2");
674
675module_init(ad7150_init);
676module_exit(ad7150_exit);
diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
index 662584d72a74..152d3be6d97d 100644
--- a/drivers/staging/iio/cdc/ad7152.c
+++ b/drivers/staging/iio/cdc/ad7152.c
@@ -540,20 +540,8 @@ static struct i2c_driver ad7152_driver = {
540 .remove = __devexit_p(ad7152_remove), 540 .remove = __devexit_p(ad7152_remove),
541 .id_table = ad7152_id, 541 .id_table = ad7152_id,
542}; 542};
543 543module_i2c_driver(ad7152_driver);
544static __init int ad7152_init(void)
545{
546 return i2c_add_driver(&ad7152_driver);
547}
548
549static __exit void ad7152_exit(void)
550{
551 i2c_del_driver(&ad7152_driver);
552}
553 544
554MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 545MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
555MODULE_DESCRIPTION("Analog Devices AD7152/3 capacitive sensor driver"); 546MODULE_DESCRIPTION("Analog Devices AD7152/3 capacitive sensor driver");
556MODULE_LICENSE("GPL v2"); 547MODULE_LICENSE("GPL v2");
557
558module_init(ad7152_init);
559module_exit(ad7152_exit);
diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index 2867943309cc..9df590891a69 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -788,20 +788,8 @@ static struct i2c_driver ad7746_driver = {
788 .remove = __devexit_p(ad7746_remove), 788 .remove = __devexit_p(ad7746_remove),
789 .id_table = ad7746_id, 789 .id_table = ad7746_id,
790}; 790};
791 791module_i2c_driver(ad7746_driver);
792static __init int ad7746_init(void)
793{
794 return i2c_add_driver(&ad7746_driver);
795}
796
797static __exit void ad7746_exit(void)
798{
799 i2c_del_driver(&ad7746_driver);
800}
801 792
802MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 793MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
803MODULE_DESCRIPTION("Analog Devices AD7746/5/7 capacitive sensor driver"); 794MODULE_DESCRIPTION("Analog Devices AD7746/5/7 capacitive sensor driver");
804MODULE_LICENSE("GPL v2"); 795MODULE_LICENSE("GPL v2");
805
806module_init(ad7746_init);
807module_exit(ad7746_exit);
diff --git a/drivers/staging/iio/dac/ad5064.c b/drivers/staging/iio/dac/ad5064.c
index 24279f2ae41f..39cfe6cb02a2 100644
--- a/drivers/staging/iio/dac/ad5064.c
+++ b/drivers/staging/iio/dac/ad5064.c
@@ -445,18 +445,7 @@ static struct spi_driver ad5064_driver = {
445 .remove = __devexit_p(ad5064_remove), 445 .remove = __devexit_p(ad5064_remove),
446 .id_table = ad5064_id, 446 .id_table = ad5064_id,
447}; 447};
448 448module_spi_driver(ad5064_driver);
449static __init int ad5064_spi_init(void)
450{
451 return spi_register_driver(&ad5064_driver);
452}
453module_init(ad5064_spi_init);
454
455static __exit void ad5064_spi_exit(void)
456{
457 spi_unregister_driver(&ad5064_driver);
458}
459module_exit(ad5064_spi_exit);
460 449
461MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 450MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
462MODULE_DESCRIPTION("Analog Devices AD5064/64-1/44/24 DAC"); 451MODULE_DESCRIPTION("Analog Devices AD5064/64-1/44/24 DAC");
diff --git a/drivers/staging/iio/dac/ad5360.c b/drivers/staging/iio/dac/ad5360.c
index 72d0f3f0d6ae..bc0459e32d04 100644
--- a/drivers/staging/iio/dac/ad5360.c
+++ b/drivers/staging/iio/dac/ad5360.c
@@ -563,18 +563,7 @@ static struct spi_driver ad5360_driver = {
563 .remove = __devexit_p(ad5360_remove), 563 .remove = __devexit_p(ad5360_remove),
564 .id_table = ad5360_ids, 564 .id_table = ad5360_ids,
565}; 565};
566 566module_spi_driver(ad5360_driver);
567static __init int ad5360_spi_init(void)
568{
569 return spi_register_driver(&ad5360_driver);
570}
571module_init(ad5360_spi_init);
572
573static __exit void ad5360_spi_exit(void)
574{
575 spi_unregister_driver(&ad5360_driver);
576}
577module_exit(ad5360_spi_exit);
578 567
579MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 568MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
580MODULE_DESCRIPTION("Analog Devices AD5360/61/62/63/70/71/72/73 DAC"); 569MODULE_DESCRIPTION("Analog Devices AD5360/61/62/63/70/71/72/73 DAC");
diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c
index e1c204d51d8c..ac3bc5f52dcc 100644
--- a/drivers/staging/iio/dac/ad5446.c
+++ b/drivers/staging/iio/dac/ad5446.c
@@ -465,18 +465,7 @@ static struct spi_driver ad5446_driver = {
465 .remove = __devexit_p(ad5446_remove), 465 .remove = __devexit_p(ad5446_remove),
466 .id_table = ad5446_id, 466 .id_table = ad5446_id,
467}; 467};
468 468module_spi_driver(ad5446_driver);
469static int __init ad5446_init(void)
470{
471 return spi_register_driver(&ad5446_driver);
472}
473module_init(ad5446_init);
474
475static void __exit ad5446_exit(void)
476{
477 spi_unregister_driver(&ad5446_driver);
478}
479module_exit(ad5446_exit);
480 469
481MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 470MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
482MODULE_DESCRIPTION("Analog Devices AD5444/AD5446 DAC"); 471MODULE_DESCRIPTION("Analog Devices AD5444/AD5446 DAC");
diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c
index 60dd6404d689..57539ce8e6cf 100644
--- a/drivers/staging/iio/dac/ad5504.c
+++ b/drivers/staging/iio/dac/ad5504.c
@@ -377,18 +377,7 @@ static struct spi_driver ad5504_driver = {
377 .remove = __devexit_p(ad5504_remove), 377 .remove = __devexit_p(ad5504_remove),
378 .id_table = ad5504_id, 378 .id_table = ad5504_id,
379}; 379};
380 380module_spi_driver(ad5504_driver);
381static __init int ad5504_spi_init(void)
382{
383 return spi_register_driver(&ad5504_driver);
384}
385module_init(ad5504_spi_init);
386
387static __exit void ad5504_spi_exit(void)
388{
389 spi_unregister_driver(&ad5504_driver);
390}
391module_exit(ad5504_spi_exit);
392 381
393MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 382MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
394MODULE_DESCRIPTION("Analog Devices AD5501/AD5501 DAC"); 383MODULE_DESCRIPTION("Analog Devices AD5501/AD5501 DAC");
diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c
index 284d87900362..6e05f0dbae0b 100644
--- a/drivers/staging/iio/dac/ad5624r_spi.c
+++ b/drivers/staging/iio/dac/ad5624r_spi.c
@@ -317,18 +317,7 @@ static struct spi_driver ad5624r_driver = {
317 .remove = __devexit_p(ad5624r_remove), 317 .remove = __devexit_p(ad5624r_remove),
318 .id_table = ad5624r_id, 318 .id_table = ad5624r_id,
319}; 319};
320 320module_spi_driver(ad5624r_driver);
321static __init int ad5624r_spi_init(void)
322{
323 return spi_register_driver(&ad5624r_driver);
324}
325module_init(ad5624r_spi_init);
326
327static __exit void ad5624r_spi_exit(void)
328{
329 spi_unregister_driver(&ad5624r_driver);
330}
331module_exit(ad5624r_spi_exit);
332 321
333MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 322MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
334MODULE_DESCRIPTION("Analog Devices AD5624/44/64R DAC spi driver"); 323MODULE_DESCRIPTION("Analog Devices AD5624/44/64R DAC spi driver");
diff --git a/drivers/staging/iio/dac/ad5686.c b/drivers/staging/iio/dac/ad5686.c
index 974c6f5b60c4..e72db2fbfedf 100644
--- a/drivers/staging/iio/dac/ad5686.c
+++ b/drivers/staging/iio/dac/ad5686.c
@@ -447,18 +447,7 @@ static struct spi_driver ad5686_driver = {
447 .remove = __devexit_p(ad5686_remove), 447 .remove = __devexit_p(ad5686_remove),
448 .id_table = ad5686_id, 448 .id_table = ad5686_id,
449}; 449};
450 450module_spi_driver(ad5686_driver);
451static __init int ad5686_spi_init(void)
452{
453 return spi_register_driver(&ad5686_driver);
454}
455module_init(ad5686_spi_init);
456
457static __exit void ad5686_spi_exit(void)
458{
459 spi_unregister_driver(&ad5686_driver);
460}
461module_exit(ad5686_spi_exit);
462 451
463MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 452MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
464MODULE_DESCRIPTION("Analog Devices AD5686/85/84 DAC"); 453MODULE_DESCRIPTION("Analog Devices AD5686/85/84 DAC");
diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c
index 6fbca8d96153..4a80fd822231 100644
--- a/drivers/staging/iio/dac/ad5791.c
+++ b/drivers/staging/iio/dac/ad5791.c
@@ -410,18 +410,7 @@ static struct spi_driver ad5791_driver = {
410 .remove = __devexit_p(ad5791_remove), 410 .remove = __devexit_p(ad5791_remove),
411 .id_table = ad5791_id, 411 .id_table = ad5791_id,
412}; 412};
413 413module_spi_driver(ad5791_driver);
414static __init int ad5791_spi_init(void)
415{
416 return spi_register_driver(&ad5791_driver);
417}
418module_init(ad5791_spi_init);
419
420static __exit void ad5791_spi_exit(void)
421{
422 spi_unregister_driver(&ad5791_driver);
423}
424module_exit(ad5791_spi_exit);
425 414
426MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 415MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
427MODULE_DESCRIPTION("Analog Devices AD5760/AD5780/AD5781/AD5791 DAC"); 416MODULE_DESCRIPTION("Analog Devices AD5760/AD5780/AD5781/AD5791 DAC");
diff --git a/drivers/staging/iio/dac/max517.c b/drivers/staging/iio/dac/max517.c
index adfbd20f8988..a4df6d7443c1 100644
--- a/drivers/staging/iio/dac/max517.c
+++ b/drivers/staging/iio/dac/max517.c
@@ -280,20 +280,8 @@ static struct i2c_driver max517_driver = {
280 .resume = max517_resume, 280 .resume = max517_resume,
281 .id_table = max517_id, 281 .id_table = max517_id,
282}; 282};
283 283module_i2c_driver(max517_driver);
284static int __init max517_init(void)
285{
286 return i2c_add_driver(&max517_driver);
287}
288
289static void __exit max517_exit(void)
290{
291 i2c_del_driver(&max517_driver);
292}
293 284
294MODULE_AUTHOR("Roland Stigge <stigge@antcom.de>"); 285MODULE_AUTHOR("Roland Stigge <stigge@antcom.de>");
295MODULE_DESCRIPTION("MAX517/MAX518/MAX519 8-bit DAC"); 286MODULE_DESCRIPTION("MAX517/MAX518/MAX519 8-bit DAC");
296MODULE_LICENSE("GPL"); 287MODULE_LICENSE("GPL");
297
298module_init(max517_init);
299module_exit(max517_exit);
diff --git a/drivers/staging/iio/dds/ad5930.c b/drivers/staging/iio/dds/ad5930.c
index f5e368b56650..4a360d044a36 100644
--- a/drivers/staging/iio/dds/ad5930.c
+++ b/drivers/staging/iio/dds/ad5930.c
@@ -143,18 +143,7 @@ static struct spi_driver ad5930_driver = {
143 .probe = ad5930_probe, 143 .probe = ad5930_probe,
144 .remove = __devexit_p(ad5930_remove), 144 .remove = __devexit_p(ad5930_remove),
145}; 145};
146 146module_spi_driver(ad5930_driver);
147static __init int ad5930_spi_init(void)
148{
149 return spi_register_driver(&ad5930_driver);
150}
151module_init(ad5930_spi_init);
152
153static __exit void ad5930_spi_exit(void)
154{
155 spi_unregister_driver(&ad5930_driver);
156}
157module_exit(ad5930_spi_exit);
158 147
159MODULE_AUTHOR("Cliff Cai"); 148MODULE_AUTHOR("Cliff Cai");
160MODULE_DESCRIPTION("Analog Devices ad5930 driver"); 149MODULE_DESCRIPTION("Analog Devices ad5930 driver");
diff --git a/drivers/staging/iio/dds/ad9832.c b/drivers/staging/iio/dds/ad9832.c
index 9b4ff6065359..cc32fd65b8b3 100644
--- a/drivers/staging/iio/dds/ad9832.c
+++ b/drivers/staging/iio/dds/ad9832.c
@@ -355,18 +355,7 @@ static struct spi_driver ad9832_driver = {
355 .remove = __devexit_p(ad9832_remove), 355 .remove = __devexit_p(ad9832_remove),
356 .id_table = ad9832_id, 356 .id_table = ad9832_id,
357}; 357};
358 358module_spi_driver(ad9832_driver);
359static int __init ad9832_init(void)
360{
361 return spi_register_driver(&ad9832_driver);
362}
363module_init(ad9832_init);
364
365static void __exit ad9832_exit(void)
366{
367 spi_unregister_driver(&ad9832_driver);
368}
369module_exit(ad9832_exit);
370 359
371MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 360MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
372MODULE_DESCRIPTION("Analog Devices AD9832/AD9835 DDS"); 361MODULE_DESCRIPTION("Analog Devices AD9832/AD9835 DDS");
diff --git a/drivers/staging/iio/dds/ad9834.c b/drivers/staging/iio/dds/ad9834.c
index c468f696fe25..2b31e3524826 100644
--- a/drivers/staging/iio/dds/ad9834.c
+++ b/drivers/staging/iio/dds/ad9834.c
@@ -446,18 +446,7 @@ static struct spi_driver ad9834_driver = {
446 .remove = __devexit_p(ad9834_remove), 446 .remove = __devexit_p(ad9834_remove),
447 .id_table = ad9834_id, 447 .id_table = ad9834_id,
448}; 448};
449 449module_spi_driver(ad9834_driver);
450static int __init ad9834_init(void)
451{
452 return spi_register_driver(&ad9834_driver);
453}
454module_init(ad9834_init);
455
456static void __exit ad9834_exit(void)
457{
458 spi_unregister_driver(&ad9834_driver);
459}
460module_exit(ad9834_exit);
461 450
462MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 451MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
463MODULE_DESCRIPTION("Analog Devices AD9833/AD9834/AD9837/AD9838 DDS"); 452MODULE_DESCRIPTION("Analog Devices AD9833/AD9834/AD9837/AD9838 DDS");
diff --git a/drivers/staging/iio/dds/ad9850.c b/drivers/staging/iio/dds/ad9850.c
index a14771b24c50..f9c96afcb996 100644
--- a/drivers/staging/iio/dds/ad9850.c
+++ b/drivers/staging/iio/dds/ad9850.c
@@ -129,18 +129,7 @@ static struct spi_driver ad9850_driver = {
129 .probe = ad9850_probe, 129 .probe = ad9850_probe,
130 .remove = __devexit_p(ad9850_remove), 130 .remove = __devexit_p(ad9850_remove),
131}; 131};
132 132module_spi_driver(ad9850_driver);
133static __init int ad9850_spi_init(void)
134{
135 return spi_register_driver(&ad9850_driver);
136}
137module_init(ad9850_spi_init);
138
139static __exit void ad9850_spi_exit(void)
140{
141 spi_unregister_driver(&ad9850_driver);
142}
143module_exit(ad9850_spi_exit);
144 133
145MODULE_AUTHOR("Cliff Cai"); 134MODULE_AUTHOR("Cliff Cai");
146MODULE_DESCRIPTION("Analog Devices ad9850 driver"); 135MODULE_DESCRIPTION("Analog Devices ad9850 driver");
diff --git a/drivers/staging/iio/dds/ad9852.c b/drivers/staging/iio/dds/ad9852.c
index cfceaa64a53a..9fc73fdc9c3b 100644
--- a/drivers/staging/iio/dds/ad9852.c
+++ b/drivers/staging/iio/dds/ad9852.c
@@ -280,18 +280,7 @@ static struct spi_driver ad9852_driver = {
280 .probe = ad9852_probe, 280 .probe = ad9852_probe,
281 .remove = __devexit_p(ad9852_remove), 281 .remove = __devexit_p(ad9852_remove),
282}; 282};
283 283module_spi_driver(ad9852_driver);
284static __init int ad9852_spi_init(void)
285{
286 return spi_register_driver(&ad9852_driver);
287}
288module_init(ad9852_spi_init);
289
290static __exit void ad9852_spi_exit(void)
291{
292 spi_unregister_driver(&ad9852_driver);
293}
294module_exit(ad9852_spi_exit);
295 284
296MODULE_AUTHOR("Cliff Cai"); 285MODULE_AUTHOR("Cliff Cai");
297MODULE_DESCRIPTION("Analog Devices ad9852 driver"); 286MODULE_DESCRIPTION("Analog Devices ad9852 driver");
diff --git a/drivers/staging/iio/dds/ad9910.c b/drivers/staging/iio/dds/ad9910.c
index da83d2b88c4a..57046b03121f 100644
--- a/drivers/staging/iio/dds/ad9910.c
+++ b/drivers/staging/iio/dds/ad9910.c
@@ -413,18 +413,7 @@ static struct spi_driver ad9910_driver = {
413 .probe = ad9910_probe, 413 .probe = ad9910_probe,
414 .remove = __devexit_p(ad9910_remove), 414 .remove = __devexit_p(ad9910_remove),
415}; 415};
416 416module_spi_driver(ad9910_driver);
417static __init int ad9910_spi_init(void)
418{
419 return spi_register_driver(&ad9910_driver);
420}
421module_init(ad9910_spi_init);
422
423static __exit void ad9910_spi_exit(void)
424{
425 spi_unregister_driver(&ad9910_driver);
426}
427module_exit(ad9910_spi_exit);
428 417
429MODULE_AUTHOR("Cliff Cai"); 418MODULE_AUTHOR("Cliff Cai");
430MODULE_DESCRIPTION("Analog Devices ad9910 driver"); 419MODULE_DESCRIPTION("Analog Devices ad9910 driver");
diff --git a/drivers/staging/iio/dds/ad9951.c b/drivers/staging/iio/dds/ad9951.c
index 20c182576def..d29130e9acdf 100644
--- a/drivers/staging/iio/dds/ad9951.c
+++ b/drivers/staging/iio/dds/ad9951.c
@@ -224,18 +224,7 @@ static struct spi_driver ad9951_driver = {
224 .probe = ad9951_probe, 224 .probe = ad9951_probe,
225 .remove = __devexit_p(ad9951_remove), 225 .remove = __devexit_p(ad9951_remove),
226}; 226};
227 227module_spi_driver(ad9951_driver);
228static __init int ad9951_spi_init(void)
229{
230 return spi_register_driver(&ad9951_driver);
231}
232module_init(ad9951_spi_init);
233
234static __exit void ad9951_spi_exit(void)
235{
236 spi_unregister_driver(&ad9951_driver);
237}
238module_exit(ad9951_spi_exit);
239 228
240MODULE_AUTHOR("Cliff Cai"); 229MODULE_AUTHOR("Cliff Cai");
241MODULE_DESCRIPTION("Analog Devices ad9951 driver"); 230MODULE_DESCRIPTION("Analog Devices ad9951 driver");
diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c
index 5d7a906fec78..9405f2d368ee 100644
--- a/drivers/staging/iio/gyro/adis16080_core.c
+++ b/drivers/staging/iio/gyro/adis16080_core.c
@@ -189,18 +189,7 @@ static struct spi_driver adis16080_driver = {
189 .probe = adis16080_probe, 189 .probe = adis16080_probe,
190 .remove = __devexit_p(adis16080_remove), 190 .remove = __devexit_p(adis16080_remove),
191}; 191};
192 192module_spi_driver(adis16080_driver);
193static __init int adis16080_init(void)
194{
195 return spi_register_driver(&adis16080_driver);
196}
197module_init(adis16080_init);
198
199static __exit void adis16080_exit(void)
200{
201 spi_unregister_driver(&adis16080_driver);
202}
203module_exit(adis16080_exit);
204 193
205MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 194MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
206MODULE_DESCRIPTION("Analog Devices ADIS16080/100 Yaw Rate Gyroscope Driver"); 195MODULE_DESCRIPTION("Analog Devices ADIS16080/100 Yaw Rate Gyroscope Driver");
diff --git a/drivers/staging/iio/gyro/adis16130_core.c b/drivers/staging/iio/gyro/adis16130_core.c
index 749240d0d8cb..c9aaca9631f4 100644
--- a/drivers/staging/iio/gyro/adis16130_core.c
+++ b/drivers/staging/iio/gyro/adis16130_core.c
@@ -168,18 +168,7 @@ static struct spi_driver adis16130_driver = {
168 .probe = adis16130_probe, 168 .probe = adis16130_probe,
169 .remove = __devexit_p(adis16130_remove), 169 .remove = __devexit_p(adis16130_remove),
170}; 170};
171 171module_spi_driver(adis16130_driver);
172static __init int adis16130_init(void)
173{
174 return spi_register_driver(&adis16130_driver);
175}
176module_init(adis16130_init);
177
178static __exit void adis16130_exit(void)
179{
180 spi_unregister_driver(&adis16130_driver);
181}
182module_exit(adis16130_exit);
183 172
184MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 173MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
185MODULE_DESCRIPTION("Analog Devices ADIS16130 High Precision Angular Rate"); 174MODULE_DESCRIPTION("Analog Devices ADIS16130 High Precision Angular Rate");
diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c
index aaa3967f8c03..886dddf867ef 100644
--- a/drivers/staging/iio/gyro/adis16260_core.c
+++ b/drivers/staging/iio/gyro/adis16260_core.c
@@ -711,18 +711,7 @@ static struct spi_driver adis16260_driver = {
711 .remove = __devexit_p(adis16260_remove), 711 .remove = __devexit_p(adis16260_remove),
712 .id_table = adis16260_id, 712 .id_table = adis16260_id,
713}; 713};
714 714module_spi_driver(adis16260_driver);
715static __init int adis16260_init(void)
716{
717 return spi_register_driver(&adis16260_driver);
718}
719module_init(adis16260_init);
720
721static __exit void adis16260_exit(void)
722{
723 spi_unregister_driver(&adis16260_driver);
724}
725module_exit(adis16260_exit);
726 715
727MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 716MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
728MODULE_DESCRIPTION("Analog Devices ADIS16260/5 Digital Gyroscope Sensor"); 717MODULE_DESCRIPTION("Analog Devices ADIS16260/5 Digital Gyroscope Sensor");
diff --git a/drivers/staging/iio/gyro/adxrs450_core.c b/drivers/staging/iio/gyro/adxrs450_core.c
index 3c3ef796d48e..70fd468b6850 100644
--- a/drivers/staging/iio/gyro/adxrs450_core.c
+++ b/drivers/staging/iio/gyro/adxrs450_core.c
@@ -381,18 +381,7 @@ static struct spi_driver adxrs450_driver = {
381 .probe = adxrs450_probe, 381 .probe = adxrs450_probe,
382 .remove = __devexit_p(adxrs450_remove), 382 .remove = __devexit_p(adxrs450_remove),
383}; 383};
384 384module_spi_driver(adxrs450_driver);
385static __init int adxrs450_init(void)
386{
387 return spi_register_driver(&adxrs450_driver);
388}
389module_init(adxrs450_init);
390
391static __exit void adxrs450_exit(void)
392{
393 spi_unregister_driver(&adxrs450_driver);
394}
395module_exit(adxrs450_exit);
396 385
397MODULE_AUTHOR("Cliff Cai <cliff.cai@xxxxxxxxxx>"); 386MODULE_AUTHOR("Cliff Cai <cliff.cai@xxxxxxxxxx>");
398MODULE_DESCRIPTION("Analog Devices ADXRS450 Gyroscope SPI driver"); 387MODULE_DESCRIPTION("Analog Devices ADXRS450 Gyroscope SPI driver");
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 1086e0befc28..454d131455de 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -796,18 +796,7 @@ static struct i2c_driver ad5933_driver = {
796 .remove = __devexit_p(ad5933_remove), 796 .remove = __devexit_p(ad5933_remove),
797 .id_table = ad5933_id, 797 .id_table = ad5933_id,
798}; 798};
799 799module_i2c_driver(ad5933_driver);
800static __init int ad5933_init(void)
801{
802 return i2c_add_driver(&ad5933_driver);
803}
804module_init(ad5933_init);
805
806static __exit void ad5933_exit(void)
807{
808 i2c_del_driver(&ad5933_driver);
809}
810module_exit(ad5933_exit);
811 800
812MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 801MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
813MODULE_DESCRIPTION("Analog Devices AD5933 Impedance Conv. Network Analyzer"); 802MODULE_DESCRIPTION("Analog Devices AD5933 Impedance Conv. Network Analyzer");
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c
index d082a37c4fb7..efc0f6529008 100644
--- a/drivers/staging/iio/imu/adis16400_core.c
+++ b/drivers/staging/iio/imu/adis16400_core.c
@@ -1128,18 +1128,7 @@ static struct spi_driver adis16400_driver = {
1128 .probe = adis16400_probe, 1128 .probe = adis16400_probe,
1129 .remove = __devexit_p(adis16400_remove), 1129 .remove = __devexit_p(adis16400_remove),
1130}; 1130};
1131 1131module_spi_driver(adis16400_driver);
1132static __init int adis16400_init(void)
1133{
1134 return spi_register_driver(&adis16400_driver);
1135}
1136module_init(adis16400_init);
1137
1138static __exit void adis16400_exit(void)
1139{
1140 spi_unregister_driver(&adis16400_driver);
1141}
1142module_exit(adis16400_exit);
1143 1132
1144MODULE_AUTHOR("Manuel Stahl <manuel.stahl@iis.fraunhofer.de>"); 1133MODULE_AUTHOR("Manuel Stahl <manuel.stahl@iis.fraunhofer.de>");
1145MODULE_DESCRIPTION("Analog Devices ADIS16400/5 IMU SPI driver"); 1134MODULE_DESCRIPTION("Analog Devices ADIS16400/5 IMU SPI driver");
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
index 9dc9e6358394..47638362224b 100644
--- a/drivers/staging/iio/light/isl29018.c
+++ b/drivers/staging/iio/light/isl29018.c
@@ -603,19 +603,7 @@ static struct i2c_driver isl29018_driver = {
603 .remove = __devexit_p(isl29018_remove), 603 .remove = __devexit_p(isl29018_remove),
604 .id_table = isl29018_id, 604 .id_table = isl29018_id,
605}; 605};
606 606module_i2c_driver(isl29018_driver);
607static int __init isl29018_init(void)
608{
609 return i2c_add_driver(&isl29018_driver);
610}
611
612static void __exit isl29018_exit(void)
613{
614 i2c_del_driver(&isl29018_driver);
615}
616
617module_init(isl29018_init);
618module_exit(isl29018_exit);
619 607
620MODULE_DESCRIPTION("ISL29018 Ambient Light Sensor driver"); 608MODULE_DESCRIPTION("ISL29018 Ambient Light Sensor driver");
621MODULE_LICENSE("GPL"); 609MODULE_LICENSE("GPL");
diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c
index 7e984bcf8d7e..1942db13b03b 100644
--- a/drivers/staging/iio/light/tsl2563.c
+++ b/drivers/staging/iio/light/tsl2563.c
@@ -866,20 +866,8 @@ static struct i2c_driver tsl2563_i2c_driver = {
866 .remove = __devexit_p(tsl2563_remove), 866 .remove = __devexit_p(tsl2563_remove),
867 .id_table = tsl2563_id, 867 .id_table = tsl2563_id,
868}; 868};
869 869module_i2c_driver(tsl2563_i2c_driver);
870static int __init tsl2563_init(void)
871{
872 return i2c_add_driver(&tsl2563_i2c_driver);
873}
874
875static void __exit tsl2563_exit(void)
876{
877 i2c_del_driver(&tsl2563_i2c_driver);
878}
879 870
880MODULE_AUTHOR("Nokia Corporation"); 871MODULE_AUTHOR("Nokia Corporation");
881MODULE_DESCRIPTION("tsl2563 light sensor driver"); 872MODULE_DESCRIPTION("tsl2563 light sensor driver");
882MODULE_LICENSE("GPL"); 873MODULE_LICENSE("GPL");
883
884module_init(tsl2563_init);
885module_exit(tsl2563_exit);
diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
index 80f77cf8e9c2..3836f73a5296 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -933,19 +933,7 @@ static struct i2c_driver taos_driver = {
933 .probe = taos_probe, 933 .probe = taos_probe,
934 .remove = __devexit_p(taos_remove), 934 .remove = __devexit_p(taos_remove),
935}; 935};
936 936module_i2c_driver(taos_driver);
937static int __init taos_init(void)
938{
939 return i2c_add_driver(&taos_driver);
940}
941
942static void __exit taos_exit(void)
943{
944 i2c_del_driver(&taos_driver);
945}
946
947module_init(taos_init);
948module_exit(taos_exit);
949 937
950MODULE_AUTHOR("J. August Brenner<jbrenner@taosinc.com>"); 938MODULE_AUTHOR("J. August Brenner<jbrenner@taosinc.com>");
951MODULE_DESCRIPTION("TAOS tsl2583 ambient light sensor driver"); 939MODULE_DESCRIPTION("TAOS tsl2583 ambient light sensor driver");
diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c
index 8b017127fd4d..db31d6d0e5b6 100644
--- a/drivers/staging/iio/magnetometer/ak8975.c
+++ b/drivers/staging/iio/magnetometer/ak8975.c
@@ -572,19 +572,7 @@ static struct i2c_driver ak8975_driver = {
572 .remove = __devexit_p(ak8975_remove), 572 .remove = __devexit_p(ak8975_remove),
573 .id_table = ak8975_id, 573 .id_table = ak8975_id,
574}; 574};
575 575module_i2c_driver(ak8975_driver);
576static int __init ak8975_init(void)
577{
578 return i2c_add_driver(&ak8975_driver);
579}
580
581static void __exit ak8975_exit(void)
582{
583 i2c_del_driver(&ak8975_driver);
584}
585
586module_init(ak8975_init);
587module_exit(ak8975_exit);
588 576
589MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>"); 577MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
590MODULE_DESCRIPTION("AK8975 magnetometer driver"); 578MODULE_DESCRIPTION("AK8975 magnetometer driver");
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
index fc9ee970888d..7bb1bc605136 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.c
+++ b/drivers/staging/iio/magnetometer/hmc5843.c
@@ -618,20 +618,8 @@ static struct i2c_driver hmc5843_driver = {
618 .suspend = hmc5843_suspend, 618 .suspend = hmc5843_suspend,
619 .resume = hmc5843_resume, 619 .resume = hmc5843_resume,
620}; 620};
621 621module_i2c_driver(hmc5843_driver);
622static int __init hmc5843_init(void)
623{
624 return i2c_add_driver(&hmc5843_driver);
625}
626
627static void __exit hmc5843_exit(void)
628{
629 i2c_del_driver(&hmc5843_driver);
630}
631 622
632MODULE_AUTHOR("Shubhrajyoti Datta <shubhrajyoti@ti.com"); 623MODULE_AUTHOR("Shubhrajyoti Datta <shubhrajyoti@ti.com");
633MODULE_DESCRIPTION("HMC5843 driver"); 624MODULE_DESCRIPTION("HMC5843 driver");
634MODULE_LICENSE("GPL"); 625MODULE_LICENSE("GPL");
635
636module_init(hmc5843_init);
637module_exit(hmc5843_exit);
diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
index 940fef602b18..4c7b0cbf49fa 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -577,18 +577,7 @@ static struct spi_driver ade7753_driver = {
577 .probe = ade7753_probe, 577 .probe = ade7753_probe,
578 .remove = __devexit_p(ade7753_remove), 578 .remove = __devexit_p(ade7753_remove),
579}; 579};
580 580module_spi_driver(ade7753_driver);
581static __init int ade7753_init(void)
582{
583 return spi_register_driver(&ade7753_driver);
584}
585module_init(ade7753_init);
586
587static __exit void ade7753_exit(void)
588{
589 spi_unregister_driver(&ade7753_driver);
590}
591module_exit(ade7753_exit);
592 581
593MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 582MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
594MODULE_DESCRIPTION("Analog Devices ADE7753/6 Single-Phase Multifunction Meter"); 583MODULE_DESCRIPTION("Analog Devices ADE7753/6 Single-Phase Multifunction Meter");
diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
index 33f0d327c9fa..15c98cde76d1 100644
--- a/drivers/staging/iio/meter/ade7754.c
+++ b/drivers/staging/iio/meter/ade7754.c
@@ -600,18 +600,7 @@ static struct spi_driver ade7754_driver = {
600 .probe = ade7754_probe, 600 .probe = ade7754_probe,
601 .remove = __devexit_p(ade7754_remove), 601 .remove = __devexit_p(ade7754_remove),
602}; 602};
603 603module_spi_driver(ade7754_driver);
604static __init int ade7754_init(void)
605{
606 return spi_register_driver(&ade7754_driver);
607}
608module_init(ade7754_init);
609
610static __exit void ade7754_exit(void)
611{
612 spi_unregister_driver(&ade7754_driver);
613}
614module_exit(ade7754_exit);
615 604
616MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 605MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
617MODULE_DESCRIPTION("Analog Devices ADE7754 Polyphase Multifunction Energy Metering IC Driver"); 606MODULE_DESCRIPTION("Analog Devices ADE7754 Polyphase Multifunction Energy Metering IC Driver");
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index c5dafbdf3bda..39338bcb1872 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -853,18 +853,7 @@ static struct spi_driver ade7758_driver = {
853 .remove = __devexit_p(ade7758_remove), 853 .remove = __devexit_p(ade7758_remove),
854 .id_table = ade7758_id, 854 .id_table = ade7758_id,
855}; 855};
856 856module_spi_driver(ade7758_driver);
857static __init int ade7758_init(void)
858{
859 return spi_register_driver(&ade7758_driver);
860}
861module_init(ade7758_init);
862
863static __exit void ade7758_exit(void)
864{
865 spi_unregister_driver(&ade7758_driver);
866}
867module_exit(ade7758_exit);
868 857
869MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 858MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
870MODULE_DESCRIPTION("Analog Devices ADE7758 Polyphase Multifunction Energy Metering IC Driver"); 859MODULE_DESCRIPTION("Analog Devices ADE7758 Polyphase Multifunction Energy Metering IC Driver");
diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
index b691f10ce988..cfa2a5eff122 100644
--- a/drivers/staging/iio/meter/ade7759.c
+++ b/drivers/staging/iio/meter/ade7759.c
@@ -521,18 +521,7 @@ static struct spi_driver ade7759_driver = {
521 .probe = ade7759_probe, 521 .probe = ade7759_probe,
522 .remove = __devexit_p(ade7759_remove), 522 .remove = __devexit_p(ade7759_remove),
523}; 523};
524 524module_spi_driver(ade7759_driver);
525static __init int ade7759_init(void)
526{
527 return spi_register_driver(&ade7759_driver);
528}
529module_init(ade7759_init);
530
531static __exit void ade7759_exit(void)
532{
533 spi_unregister_driver(&ade7759_driver);
534}
535module_exit(ade7759_exit);
536 525
537MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 526MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
538MODULE_DESCRIPTION("Analog Devices ADE7759 Active Energy Metering IC Driver"); 527MODULE_DESCRIPTION("Analog Devices ADE7759 Active Energy Metering IC Driver");
diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c
index cbca3fd8fcd6..1e1faa0479d3 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -253,19 +253,7 @@ static struct i2c_driver ade7854_i2c_driver = {
253 .remove = __devexit_p(ade7854_i2c_remove), 253 .remove = __devexit_p(ade7854_i2c_remove),
254 .id_table = ade7854_id, 254 .id_table = ade7854_id,
255}; 255};
256 256module_i2c_driver(ade7854_i2c_driver);
257static __init int ade7854_i2c_init(void)
258{
259 return i2c_add_driver(&ade7854_i2c_driver);
260}
261module_init(ade7854_i2c_init);
262
263static __exit void ade7854_i2c_exit(void)
264{
265 i2c_del_driver(&ade7854_i2c_driver);
266}
267module_exit(ade7854_i2c_exit);
268
269 257
270MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 258MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
271MODULE_DESCRIPTION("Analog Devices ADE7854/58/68/78 Polyphase Multifunction Energy Metering IC I2C Driver"); 259MODULE_DESCRIPTION("Analog Devices ADE7854/58/68/78 Polyphase Multifunction Energy Metering IC I2C Driver");
diff --git a/drivers/staging/iio/meter/ade7854-spi.c b/drivers/staging/iio/meter/ade7854-spi.c
index cfa23ba30efe..c485a79aeec3 100644
--- a/drivers/staging/iio/meter/ade7854-spi.c
+++ b/drivers/staging/iio/meter/ade7854-spi.c
@@ -353,18 +353,7 @@ static struct spi_driver ade7854_driver = {
353 .remove = __devexit_p(ade7854_spi_remove), 353 .remove = __devexit_p(ade7854_spi_remove),
354 .id_table = ade7854_id, 354 .id_table = ade7854_id,
355}; 355};
356 356module_spi_driver(ade7854_driver);
357static __init int ade7854_init(void)
358{
359 return spi_register_driver(&ade7854_driver);
360}
361module_init(ade7854_init);
362
363static __exit void ade7854_exit(void)
364{
365 spi_unregister_driver(&ade7854_driver);
366}
367module_exit(ade7854_exit);
368 357
369MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 358MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
370MODULE_DESCRIPTION("Analog Devices ADE7854/58/68/78 SPI Driver"); 359MODULE_DESCRIPTION("Analog Devices ADE7854/58/68/78 SPI Driver");
diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c
index d7ad46aed0ff..1c6a02bfd45d 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -170,18 +170,7 @@ static struct spi_driver ad2s1200_driver = {
170 .remove = __devexit_p(ad2s1200_remove), 170 .remove = __devexit_p(ad2s1200_remove),
171 .id_table = ad2s1200_id, 171 .id_table = ad2s1200_id,
172}; 172};
173 173module_spi_driver(ad2s1200_driver);
174static __init int ad2s1200_spi_init(void)
175{
176 return spi_register_driver(&ad2s1200_driver);
177}
178module_init(ad2s1200_spi_init);
179
180static __exit void ad2s1200_spi_exit(void)
181{
182 spi_unregister_driver(&ad2s1200_driver);
183}
184module_exit(ad2s1200_spi_exit);
185 174
186MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>"); 175MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>");
187MODULE_DESCRIPTION("Analog Devices AD2S1200/1205 Resolver to Digital SPI driver"); 176MODULE_DESCRIPTION("Analog Devices AD2S1200/1205 Resolver to Digital SPI driver");
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 6401a6273625..ff1b3316d016 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -759,18 +759,7 @@ static struct spi_driver ad2s1210_driver = {
759 .remove = __devexit_p(ad2s1210_remove), 759 .remove = __devexit_p(ad2s1210_remove),
760 .id_table = ad2s1210_id, 760 .id_table = ad2s1210_id,
761}; 761};
762 762module_spi_driver(ad2s1210_driver);
763static __init int ad2s1210_spi_init(void)
764{
765 return spi_register_driver(&ad2s1210_driver);
766}
767module_init(ad2s1210_spi_init);
768
769static __exit void ad2s1210_spi_exit(void)
770{
771 spi_unregister_driver(&ad2s1210_driver);
772}
773module_exit(ad2s1210_spi_exit);
774 763
775MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>"); 764MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>");
776MODULE_DESCRIPTION("Analog Devices AD2S1210 Resolver to Digital SPI driver"); 765MODULE_DESCRIPTION("Analog Devices AD2S1210 Resolver to Digital SPI driver");
diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c
index a9200d949dcd..6d0794389e74 100644
--- a/drivers/staging/iio/resolver/ad2s90.c
+++ b/drivers/staging/iio/resolver/ad2s90.c
@@ -119,18 +119,7 @@ static struct spi_driver ad2s90_driver = {
119 .remove = __devexit_p(ad2s90_remove), 119 .remove = __devexit_p(ad2s90_remove),
120 .id_table = ad2s90_id, 120 .id_table = ad2s90_id,
121}; 121};
122 122module_spi_driver(ad2s90_driver);
123static __init int ad2s90_spi_init(void)
124{
125 return spi_register_driver(&ad2s90_driver);
126}
127module_init(ad2s90_spi_init);
128
129static __exit void ad2s90_spi_exit(void)
130{
131 spi_unregister_driver(&ad2s90_driver);
132}
133module_exit(ad2s90_spi_exit);
134 123
135MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>"); 124MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>");
136MODULE_DESCRIPTION("Analog Devices AD2S90 Resolver to Digital SPI driver"); 125MODULE_DESCRIPTION("Analog Devices AD2S90 Resolver to Digital SPI driver");
diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c
index 66aad3a0d1fd..483303402735 100644
--- a/drivers/staging/keucr/usb.c
+++ b/drivers/staging/keucr/usb.c
@@ -701,26 +701,4 @@ static struct usb_driver usb_storage_driver = {
701 .soft_unbind = 1, 701 .soft_unbind = 1,
702}; 702};
703 703
704//----- usb_stor_init() --------------------- 704module_usb_driver(usb_storage_driver);
705static int __init usb_stor_init(void)
706{
707 int retval;
708 pr_info("usb --- usb_stor_init start\n");
709
710 retval = usb_register(&usb_storage_driver);
711 if (retval == 0)
712 pr_info("ENE USB Mass Storage support registered.\n");
713
714 return retval;
715}
716
717//----- usb_stor_exit() ---------------------
718static void __exit usb_stor_exit(void)
719{
720 pr_info("usb --- usb_stor_exit\n");
721
722 usb_deregister(&usb_storage_driver) ;
723}
724
725module_init(usb_stor_init);
726module_exit(usb_stor_exit);
diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index 3db3b0a91cc1..b7175fe1b15f 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1272,17 +1272,4 @@ static struct usb_driver go7007_usb_driver = {
1272 .id_table = go7007_usb_id_table, 1272 .id_table = go7007_usb_id_table,
1273}; 1273};
1274 1274
1275static int __init go7007_usb_init(void) 1275module_usb_driver(go7007_usb_driver);
1276{
1277 return usb_register(&go7007_usb_driver);
1278}
1279
1280static void __exit go7007_usb_cleanup(void)
1281{
1282 usb_deregister(&go7007_usb_driver);
1283}
1284
1285module_init(go7007_usb_init);
1286module_exit(go7007_usb_cleanup);
1287
1288MODULE_LICENSE("GPL v2");
diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c
index 0dc2c2b22c2b..6cd4cd67a1dd 100644
--- a/drivers/staging/media/lirc/lirc_igorplugusb.c
+++ b/drivers/staging/media/lirc/lirc_igorplugusb.c
@@ -541,26 +541,7 @@ static struct usb_driver igorplugusb_remote_driver = {
541 .id_table = igorplugusb_remote_id_table 541 .id_table = igorplugusb_remote_id_table
542}; 542};
543 543
544static int __init igorplugusb_remote_init(void) 544module_usb_driver(igorplugusb_remote_driver);
545{
546 int ret = 0;
547
548 dprintk(DRIVER_NAME ": loaded, debug mode enabled\n");
549
550 ret = usb_register(&igorplugusb_remote_driver);
551 if (ret)
552 printk(KERN_ERR DRIVER_NAME ": usb register failed!\n");
553
554 return ret;
555}
556
557static void __exit igorplugusb_remote_exit(void)
558{
559 usb_deregister(&igorplugusb_remote_driver);
560}
561
562module_init(igorplugusb_remote_init);
563module_exit(igorplugusb_remote_exit);
564 545
565#include <linux/vermagic.h> 546#include <linux/vermagic.h>
566MODULE_INFO(vermagic, VERMAGIC_STRING); 547MODULE_INFO(vermagic, VERMAGIC_STRING);
diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
index f5308d5929c6..f68218012f23 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -1025,26 +1025,4 @@ static int imon_resume(struct usb_interface *intf)
1025 return rc; 1025 return rc;
1026} 1026}
1027 1027
1028static int __init imon_init(void) 1028module_usb_driver(imon_driver);
1029{
1030 int rc;
1031
1032 printk(KERN_INFO MOD_NAME ": " MOD_DESC ", v" MOD_VERSION "\n");
1033
1034 rc = usb_register(&imon_driver);
1035 if (rc) {
1036 err("%s: usb register failed(%d)", __func__, rc);
1037 return -ENODEV;
1038 }
1039
1040 return 0;
1041}
1042
1043static void __exit imon_exit(void)
1044{
1045 usb_deregister(&imon_driver);
1046 printk(KERN_INFO MOD_NAME ": module removed. Goodbye!\n");
1047}
1048
1049module_init(imon_init);
1050module_exit(imon_exit);
diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c
index a2d18b0aa048..7855baa18e75 100644
--- a/drivers/staging/media/lirc/lirc_sasem.c
+++ b/drivers/staging/media/lirc/lirc_sasem.c
@@ -913,27 +913,4 @@ static void sasem_disconnect(struct usb_interface *interface)
913 mutex_unlock(&disconnect_lock); 913 mutex_unlock(&disconnect_lock);
914} 914}
915 915
916static int __init sasem_init(void) 916module_usb_driver(sasem_driver);
917{
918 int rc;
919
920 printk(KERN_INFO MOD_DESC ", v" MOD_VERSION "\n");
921 printk(KERN_INFO MOD_AUTHOR "\n");
922
923 rc = usb_register(&sasem_driver);
924 if (rc < 0) {
925 err("%s: usb register failed (%d)", __func__, rc);
926 return -ENODEV;
927 }
928 return 0;
929}
930
931static void __exit sasem_exit(void)
932{
933 usb_deregister(&sasem_driver);
934 printk(KERN_INFO "module removed. Goodbye!\n");
935}
936
937
938module_init(sasem_init);
939module_exit(sasem_exit);
diff --git a/drivers/staging/media/lirc/lirc_ttusbir.c b/drivers/staging/media/lirc/lirc_ttusbir.c
index e4b329b8cafd..7950887ff113 100644
--- a/drivers/staging/media/lirc/lirc_ttusbir.c
+++ b/drivers/staging/media/lirc/lirc_ttusbir.c
@@ -372,24 +372,4 @@ static void disconnect(struct usb_interface *intf)
372 kfree(ttusbir); 372 kfree(ttusbir);
373} 373}
374 374
375static int ttusbir_init_module(void) 375module_usb_driver(usb_driver);
376{
377 int result;
378
379 DPRINTK(KERN_DEBUG "Module ttusbir init\n");
380
381 /* register this driver with the USB subsystem */
382 result = usb_register(&usb_driver);
383 if (result)
384 err("usb_register failed. Error number %d", result);
385 return result;
386}
387
388static void ttusbir_exit_module(void)
389{
390 printk(KERN_DEBUG "Module ttusbir exit\n");
391 usb_deregister(&usb_driver);
392}
393
394module_init(ttusbir_init_module);
395module_exit(ttusbir_exit_module);
diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
index d9cee6d0b124..2b9f785954df 100644
--- a/drivers/staging/rts5139/rts51x.c
+++ b/drivers/staging/rts5139/rts51x.c
@@ -934,34 +934,4 @@ struct usb_driver rts51x_driver = {
934 .soft_unbind = 1, 934 .soft_unbind = 1,
935}; 935};
936 936
937static int __init rts51x_init(void) 937module_usb_driver(rts51x_driver);
938{
939 int retval;
940
941 printk(KERN_INFO "Initializing %s USB card reader driver...\n",
942 RTS51X_NAME);
943
944 /* register the driver, return usb_register return code if error */
945 retval = usb_register(&rts51x_driver);
946 if (retval == 0) {
947 printk(KERN_INFO
948 "Realtek %s USB card reader support registered.\n",
949 RTS51X_NAME);
950 }
951 return retval;
952}
953
954static void __exit rts51x_exit(void)
955{
956 RTS51X_DEBUGP("rts51x_exit() called\n");
957
958 /* Deregister the driver
959 * This will cause disconnect() to be called for each
960 * attached unit
961 */
962 RTS51X_DEBUGP("-- calling usb_deregister()\n");
963 usb_deregister(&rts51x_driver);
964}
965
966module_init(rts51x_init);
967module_exit(rts51x_exit);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 27521b69ce08..541f9aa8ef6d 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -2103,16 +2103,4 @@ static struct usb_driver vt6656_driver = {
2103#endif /* CONFIG_PM */ 2103#endif /* CONFIG_PM */
2104}; 2104};
2105 2105
2106static int __init vt6656_init_module(void) 2106module_usb_driver(vt6656_driver);
2107{
2108 printk(KERN_NOTICE DEVICE_FULL_DRV_NAM " " DEVICE_VERSION);
2109 return usb_register(&vt6656_driver);
2110}
2111
2112static void __exit vt6656_cleanup_module(void)
2113{
2114 usb_deregister(&vt6656_driver);
2115}
2116
2117module_init(vt6656_init_module);
2118module_exit(vt6656_cleanup_module);
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
index f958eb4f0d81..c3751a718384 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -865,15 +865,4 @@ static struct usb_driver wb35_driver = {
865 .disconnect = wb35_disconnect, 865 .disconnect = wb35_disconnect,
866}; 866};
867 867
868static int __init wb35_init(void) 868module_usb_driver(wb35_driver);
869{
870 return usb_register(&wb35_driver);
871}
872
873static void __exit wb35_exit(void)
874{
875 usb_deregister(&wb35_driver);
876}
877
878module_init(wb35_init);
879module_exit(wb35_exit);
diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c
index 4efa027a81e4..b1aed1f1f749 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -358,16 +358,4 @@ static struct usb_driver prism2_usb_driver = {
358 /* fops, minor? */ 358 /* fops, minor? */
359}; 359};
360 360
361static int __init prism2usb_init(void) 361module_usb_driver(prism2_usb_driver);
362{
363 /* This call will result in calls to prism2sta_probe_usb. */
364 return usb_register(&prism2_usb_driver);
365};
366
367static void __exit prism2usb_cleanup(void)
368{
369 usb_deregister(&prism2_usb_driver);
370};
371
372module_init(prism2usb_init);
373module_exit(prism2usb_cleanup);
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c
index ff5059517351..72d3646c7365 100644
--- a/drivers/uio/uio_pdrv.c
+++ b/drivers/uio/uio_pdrv.c
@@ -104,17 +104,7 @@ static struct platform_driver uio_pdrv = {
104 }, 104 },
105}; 105};
106 106
107static int __init uio_pdrv_init(void) 107module_platform_driver(uio_pdrv);
108{
109 return platform_driver_register(&uio_pdrv);
110}
111
112static void __exit uio_pdrv_exit(void)
113{
114 platform_driver_unregister(&uio_pdrv);
115}
116module_init(uio_pdrv_init);
117module_exit(uio_pdrv_exit);
118 108
119MODULE_AUTHOR("Uwe Kleine-Koenig"); 109MODULE_AUTHOR("Uwe Kleine-Koenig");
120MODULE_DESCRIPTION("Userspace I/O platform driver"); 110MODULE_DESCRIPTION("Userspace I/O platform driver");
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index 25de302009a1..b98371d93a92 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -273,18 +273,7 @@ static struct platform_driver uio_pdrv_genirq = {
273 }, 273 },
274}; 274};
275 275
276static int __init uio_pdrv_genirq_init(void) 276module_platform_driver(uio_pdrv_genirq);
277{
278 return platform_driver_register(&uio_pdrv_genirq);
279}
280
281static void __exit uio_pdrv_genirq_exit(void)
282{
283 platform_driver_unregister(&uio_pdrv_genirq);
284}
285
286module_init(uio_pdrv_genirq_init);
287module_exit(uio_pdrv_genirq_exit);
288 277
289MODULE_AUTHOR("Magnus Damm"); 278MODULE_AUTHOR("Magnus Damm");
290MODULE_DESCRIPTION("Userspace I/O platform driver with generic IRQ handling"); 279MODULE_DESCRIPTION("Userspace I/O platform driver with generic IRQ handling");
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
index e67b566e7aa3..33a7a273b453 100644
--- a/drivers/uio/uio_pruss.c
+++ b/drivers/uio/uio_pruss.c
@@ -227,19 +227,7 @@ static struct platform_driver pruss_driver = {
227 }, 227 },
228}; 228};
229 229
230static int __init pruss_init_module(void) 230module_platform_driver(pruss_driver);
231{
232 return platform_driver_register(&pruss_driver);
233}
234
235module_init(pruss_init_module);
236
237static void __exit pruss_exit_module(void)
238{
239 platform_driver_unregister(&pruss_driver);
240}
241
242module_exit(pruss_exit_module);
243 231
244MODULE_LICENSE("GPL v2"); 232MODULE_LICENSE("GPL v2");
245MODULE_VERSION(DRV_VERSION); 233MODULE_VERSION(DRV_VERSION);
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index a845f8b8382f..98b89fe19867 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -1372,18 +1372,7 @@ static struct usb_driver cxacru_usb_driver = {
1372 .id_table = cxacru_usb_ids 1372 .id_table = cxacru_usb_ids
1373}; 1373};
1374 1374
1375static int __init cxacru_init(void) 1375module_usb_driver(cxacru_usb_driver);
1376{
1377 return usb_register(&cxacru_usb_driver);
1378}
1379
1380static void __exit cxacru_cleanup(void)
1381{
1382 usb_deregister(&cxacru_usb_driver);
1383}
1384
1385module_init(cxacru_init);
1386module_exit(cxacru_cleanup);
1387 1376
1388MODULE_AUTHOR(DRIVER_AUTHOR); 1377MODULE_AUTHOR(DRIVER_AUTHOR);
1389MODULE_DESCRIPTION(DRIVER_DESC); 1378MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 0842cfbf60cf..b42092e1f164 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -953,22 +953,7 @@ static int speedtch_usb_probe(struct usb_interface *intf, const struct usb_devic
953 return usbatm_usb_probe(intf, id, &speedtch_usbatm_driver); 953 return usbatm_usb_probe(intf, id, &speedtch_usbatm_driver);
954} 954}
955 955
956static int __init speedtch_usb_init(void) 956module_usb_driver(speedtch_usb_driver);
957{
958 dbg("%s: driver version %s", __func__, DRIVER_VERSION);
959
960 return usb_register(&speedtch_usb_driver);
961}
962
963static void __exit speedtch_usb_cleanup(void)
964{
965 dbg("%s", __func__);
966
967 usb_deregister(&speedtch_usb_driver);
968}
969
970module_init(speedtch_usb_init);
971module_exit(speedtch_usb_cleanup);
972 957
973MODULE_AUTHOR(DRIVER_AUTHOR); 958MODULE_AUTHOR(DRIVER_AUTHOR);
974MODULE_DESCRIPTION(DRIVER_DESC); 959MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 428f36801e06..00f171a7a8a0 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2753,36 +2753,7 @@ static struct usb_driver uea_driver = {
2753 2753
2754MODULE_DEVICE_TABLE(usb, uea_ids); 2754MODULE_DEVICE_TABLE(usb, uea_ids);
2755 2755
2756/** 2756module_usb_driver(uea_driver);
2757 * uea_init - Initialize the module.
2758 * Register to USB subsystem
2759 */
2760static int __init uea_init(void)
2761{
2762 printk(KERN_INFO "[ueagle-atm] driver " EAGLEUSBVERSION " loaded\n");
2763
2764 usb_register(&uea_driver);
2765
2766 return 0;
2767}
2768
2769module_init(uea_init);
2770
2771/**
2772 * uea_exit - Destroy module
2773 * Deregister with USB subsystem
2774 */
2775static void __exit uea_exit(void)
2776{
2777 /*
2778 * This calls automatically the uea_disconnect method if necessary:
2779 */
2780 usb_deregister(&uea_driver);
2781
2782 printk(KERN_INFO "[ueagle-atm] driver unloaded\n");
2783}
2784
2785module_exit(uea_exit);
2786 2757
2787MODULE_AUTHOR("Damien Bergamini/Matthieu Castet/Stanislaw W. Gruszka"); 2758MODULE_AUTHOR("Damien Bergamini/Matthieu Castet/Stanislaw W. Gruszka");
2788MODULE_DESCRIPTION("ADI 930/Eagle USB ADSL Modem driver"); 2759MODULE_DESCRIPTION("ADI 930/Eagle USB ADSL Modem driver");
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index efe684908c1f..1c50baff7725 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -895,24 +895,7 @@ static struct usb_driver wdm_driver = {
895 .supports_autosuspend = 1, 895 .supports_autosuspend = 1,
896}; 896};
897 897
898/* --- low level module stuff --- */ 898module_usb_driver(wdm_driver);
899
900static int __init wdm_init(void)
901{
902 int rv;
903
904 rv = usb_register(&wdm_driver);
905
906 return rv;
907}
908
909static void __exit wdm_exit(void)
910{
911 usb_deregister(&wdm_driver);
912}
913
914module_init(wdm_init);
915module_exit(wdm_exit);
916 899
917MODULE_AUTHOR(DRIVER_AUTHOR); 900MODULE_AUTHOR(DRIVER_AUTHOR);
918MODULE_DESCRIPTION(DRIVER_DESC); 901MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index cb3a93243a05..81ef2e207a8d 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -1412,18 +1412,7 @@ static struct usb_driver usblp_driver = {
1412 .supports_autosuspend = 1, 1412 .supports_autosuspend = 1,
1413}; 1413};
1414 1414
1415static int __init usblp_init(void) 1415module_usb_driver(usblp_driver);
1416{
1417 return usb_register(&usblp_driver);
1418}
1419
1420static void __exit usblp_exit(void)
1421{
1422 usb_deregister(&usblp_driver);
1423}
1424
1425module_init(usblp_init);
1426module_exit(usblp_exit);
1427 1416
1428MODULE_AUTHOR(DRIVER_AUTHOR); 1417MODULE_AUTHOR(DRIVER_AUTHOR);
1429MODULE_DESCRIPTION(DRIVER_DESC); 1418MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 12cf5e7395a8..70d69d06054f 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1116,21 +1116,6 @@ static struct usb_driver usbtmc_driver = {
1116 .resume = usbtmc_resume, 1116 .resume = usbtmc_resume,
1117}; 1117};
1118 1118
1119static int __init usbtmc_init(void) 1119module_usb_driver(usbtmc_driver);
1120{
1121 int retcode;
1122
1123 retcode = usb_register(&usbtmc_driver);
1124 if (retcode)
1125 printk(KERN_ERR KBUILD_MODNAME": Unable to register driver\n");
1126 return retcode;
1127}
1128module_init(usbtmc_init);
1129
1130static void __exit usbtmc_exit(void)
1131{
1132 usb_deregister(&usbtmc_driver);
1133}
1134module_exit(usbtmc_exit);
1135 1120
1136MODULE_LICENSE("GPL"); 1121MODULE_LICENSE("GPL");
diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
index da1ad77d8d51..fcfa91517ea1 100644
--- a/drivers/usb/dwc3/debugfs.c
+++ b/drivers/usb/dwc3/debugfs.c
@@ -51,18 +51,13 @@
51#include "gadget.h" 51#include "gadget.h"
52#include "io.h" 52#include "io.h"
53 53
54struct dwc3_register {
55 const char *name;
56 u32 offset;
57};
58
59#define dump_register(nm) \ 54#define dump_register(nm) \
60{ \ 55{ \
61 .name = __stringify(nm), \ 56 .name = __stringify(nm), \
62 .offset = DWC3_ ##nm, \ 57 .offset = DWC3_ ##nm, \
63} 58}
64 59
65static const struct dwc3_register dwc3_regs[] = { 60static const struct debugfs_reg32 dwc3_regs[] = {
66 dump_register(GSBUSCFG0), 61 dump_register(GSBUSCFG0),
67 dump_register(GSBUSCFG1), 62 dump_register(GSBUSCFG1),
68 dump_register(GTXTHRCFG), 63 dump_register(GTXTHRCFG),
@@ -382,15 +377,10 @@ static const struct dwc3_register dwc3_regs[] = {
382static int dwc3_regdump_show(struct seq_file *s, void *unused) 377static int dwc3_regdump_show(struct seq_file *s, void *unused)
383{ 378{
384 struct dwc3 *dwc = s->private; 379 struct dwc3 *dwc = s->private;
385 int i;
386 380
387 seq_printf(s, "DesignWare USB3 Core Register Dump\n"); 381 seq_printf(s, "DesignWare USB3 Core Register Dump\n");
388 382 debugfs_print_regs32(s, dwc3_regs, ARRAY_SIZE(dwc3_regs),
389 for (i = 0; i < ARRAY_SIZE(dwc3_regs); i++) { 383 dwc->regs, "");
390 seq_printf(s, "%-20s : %08x\n", dwc3_regs[i].name,
391 dwc3_readl(dwc->regs, dwc3_regs[i].offset));
392 }
393
394 return 0; 384 return 0;
395} 385}
396 386
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
index 9bfac657572e..056fb2d37c88 100644
--- a/drivers/usb/host/hwa-hc.c
+++ b/drivers/usb/host/hwa-hc.c
@@ -837,18 +837,7 @@ static struct usb_driver hwahc_driver = {
837 .id_table = hwahc_id_table, 837 .id_table = hwahc_id_table,
838}; 838};
839 839
840static int __init hwahc_driver_init(void) 840module_usb_driver(hwahc_driver);
841{
842 return usb_register(&hwahc_driver);
843}
844module_init(hwahc_driver_init);
845
846static void __exit hwahc_driver_exit(void)
847{
848 usb_deregister(&hwahc_driver);
849}
850module_exit(hwahc_driver_exit);
851
852 841
853MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); 842MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
854MODULE_DESCRIPTION("Host Wired Adapter USB Host Control Driver"); 843MODULE_DESCRIPTION("Host Wired Adapter USB Host Control Driver");
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 27e209a7222f..9c0f8caba3be 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -809,19 +809,7 @@ static void mts_usb_disconnect (struct usb_interface *intf)
809 kfree(desc); 809 kfree(desc);
810} 810}
811 811
812 812module_usb_driver(mts_usb_driver);
813static int __init microtek_drv_init(void)
814{
815 return usb_register(&mts_usb_driver);
816}
817
818static void __exit microtek_drv_exit(void)
819{
820 usb_deregister(&mts_usb_driver);
821}
822
823module_init(microtek_drv_init);
824module_exit(microtek_drv_exit);
825 813
826MODULE_AUTHOR( DRIVER_AUTHOR ); 814MODULE_AUTHOR( DRIVER_AUTHOR );
827MODULE_DESCRIPTION( DRIVER_DESC ); 815MODULE_DESCRIPTION( DRIVER_DESC );
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index fe858711651c..284b85461410 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -885,40 +885,7 @@ static struct usb_driver adu_driver = {
885 .id_table = device_table, 885 .id_table = device_table,
886}; 886};
887 887
888static int __init adu_init(void) 888module_usb_driver(adu_driver);
889{
890 int result;
891
892 dbg(2," %s : enter", __func__);
893
894 /* register this driver with the USB subsystem */
895 result = usb_register(&adu_driver);
896 if (result < 0) {
897 printk(KERN_ERR "usb_register failed for the "__FILE__
898 " driver. Error number %d\n", result);
899 goto exit;
900 }
901
902 printk(KERN_INFO "adutux " DRIVER_DESC " " DRIVER_VERSION "\n");
903 printk(KERN_INFO "adutux is an experimental driver. "
904 "Use at your own risk\n");
905
906exit:
907 dbg(2," %s : leave, return value %d", __func__, result);
908
909 return result;
910}
911
912static void __exit adu_exit(void)
913{
914 dbg(2," %s : enter", __func__);
915 /* deregister this driver with the USB subsystem */
916 usb_deregister(&adu_driver);
917 dbg(2," %s : leave", __func__);
918}
919
920module_init(adu_init);
921module_exit(adu_exit);
922 889
923MODULE_AUTHOR(DRIVER_AUTHOR); 890MODULE_AUTHOR(DRIVER_AUTHOR);
924MODULE_DESCRIPTION(DRIVER_DESC); 891MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index 9251773ecef4..3f7c1a92579f 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -271,27 +271,7 @@ static struct usb_driver cypress_driver = {
271 .id_table = cypress_table, 271 .id_table = cypress_table,
272}; 272};
273 273
274static int __init cypress_init(void) 274module_usb_driver(cypress_driver);
275{
276 int result;
277
278 /* register this driver with the USB subsystem */
279 result = usb_register(&cypress_driver);
280 if (result)
281 printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! "
282 "Error number: %d\n", result);
283
284 return result;
285}
286
287static void __exit cypress_exit(void)
288{
289 /* deregister this driver with the USB subsystem */
290 usb_deregister(&cypress_driver);
291}
292
293module_init(cypress_init);
294module_exit(cypress_exit);
295 275
296MODULE_AUTHOR(DRIVER_AUTHOR); 276MODULE_AUTHOR(DRIVER_AUTHOR);
297MODULE_DESCRIPTION(DRIVER_DESC); 277MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 1d7251bc1b5f..5b9831b95d97 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -417,31 +417,7 @@ static void cytherm_disconnect(struct usb_interface *interface)
417 dev_info(&interface->dev, "Cypress thermometer now disconnected\n"); 417 dev_info(&interface->dev, "Cypress thermometer now disconnected\n");
418} 418}
419 419
420 420module_usb_driver(cytherm_driver);
421static int __init usb_cytherm_init(void)
422{
423 int result;
424
425 result = usb_register(&cytherm_driver);
426 if (result) {
427 printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! "
428 "Error number: %d\n", result);
429 return result;
430 }
431
432 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
433 DRIVER_DESC "\n");
434 return 0;
435}
436
437static void __exit usb_cytherm_exit(void)
438{
439 usb_deregister(&cytherm_driver);
440}
441
442
443module_init (usb_cytherm_init);
444module_exit (usb_cytherm_exit);
445 421
446MODULE_AUTHOR(DRIVER_AUTHOR); 422MODULE_AUTHOR(DRIVER_AUTHOR);
447MODULE_DESCRIPTION(DRIVER_DESC); 423MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
index a6521c95f683..d9b6a0355443 100644
--- a/drivers/usb/misc/emi26.c
+++ b/drivers/usb/misc/emi26.c
@@ -276,18 +276,7 @@ static struct usb_driver emi26_driver = {
276 .id_table = id_table, 276 .id_table = id_table,
277}; 277};
278 278
279static int __init emi26_init (void) 279module_usb_driver(emi26_driver);
280{
281 return usb_register(&emi26_driver);
282}
283
284static void __exit emi26_exit (void)
285{
286 usb_deregister (&emi26_driver);
287}
288
289module_init(emi26_init);
290module_exit(emi26_exit);
291 280
292MODULE_AUTHOR("Tapio Laxström"); 281MODULE_AUTHOR("Tapio Laxström");
293MODULE_DESCRIPTION("Emagic EMI 2|6 firmware loader."); 282MODULE_DESCRIPTION("Emagic EMI 2|6 firmware loader.");
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
index fc15ad4c3139..9f39062ebb08 100644
--- a/drivers/usb/misc/emi62.c
+++ b/drivers/usb/misc/emi62.c
@@ -290,22 +290,7 @@ static struct usb_driver emi62_driver = {
290 .id_table = id_table, 290 .id_table = id_table,
291}; 291};
292 292
293static int __init emi62_init (void) 293module_usb_driver(emi62_driver);
294{
295 int retval;
296 retval = usb_register (&emi62_driver);
297 if (retval)
298 printk(KERN_ERR "adi-emi: registration failed\n");
299 return retval;
300}
301
302static void __exit emi62_exit (void)
303{
304 usb_deregister (&emi62_driver);
305}
306
307module_init(emi62_init);
308module_exit(emi62_exit);
309 294
310MODULE_AUTHOR("Tapio Laxström"); 295MODULE_AUTHOR("Tapio Laxström");
311MODULE_DESCRIPTION("Emagic EMI 6|2m firmware loader."); 296MODULE_DESCRIPTION("Emagic EMI 6|2m firmware loader.");
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index 515b67fffab1..0dee24698504 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -428,29 +428,7 @@ static void idmouse_disconnect(struct usb_interface *interface)
428 dev_info(&interface->dev, "disconnected\n"); 428 dev_info(&interface->dev, "disconnected\n");
429} 429}
430 430
431static int __init usb_idmouse_init(void) 431module_usb_driver(idmouse_driver);
432{
433 int result;
434
435 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
436 DRIVER_DESC "\n");
437
438 /* register this driver with the USB subsystem */
439 result = usb_register(&idmouse_driver);
440 if (result)
441 err("Unable to register device (error %d).", result);
442
443 return result;
444}
445
446static void __exit usb_idmouse_exit(void)
447{
448 /* deregister this driver with the USB subsystem */
449 usb_deregister(&idmouse_driver);
450}
451
452module_init(usb_idmouse_init);
453module_exit(usb_idmouse_exit);
454 432
455MODULE_AUTHOR(DRIVER_AUTHOR); 433MODULE_AUTHOR(DRIVER_AUTHOR);
456MODULE_DESCRIPTION(DRIVER_DESC); 434MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 81457904d6ba..7676b5b7e171 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -927,15 +927,4 @@ static struct usb_driver iowarrior_driver = {
927 .id_table = iowarrior_ids, 927 .id_table = iowarrior_ids,
928}; 928};
929 929
930static int __init iowarrior_init(void) 930module_usb_driver(iowarrior_driver);
931{
932 return usb_register(&iowarrior_driver);
933}
934
935static void __exit iowarrior_exit(void)
936{
937 usb_deregister(&iowarrior_driver);
938}
939
940module_init(iowarrior_init);
941module_exit(iowarrior_exit);
diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c
index fe1d44319d0a..1dc7e9581cc6 100644
--- a/drivers/usb/misc/isight_firmware.c
+++ b/drivers/usb/misc/isight_firmware.c
@@ -126,18 +126,7 @@ static struct usb_driver isight_firmware_driver = {
126 .id_table = id_table, 126 .id_table = id_table,
127}; 127};
128 128
129static int __init isight_firmware_init(void) 129module_usb_driver(isight_firmware_driver);
130{
131 return usb_register(&isight_firmware_driver);
132}
133
134static void __exit isight_firmware_exit(void)
135{
136 usb_deregister(&isight_firmware_driver);
137}
138
139module_init(isight_firmware_init);
140module_exit(isight_firmware_exit);
141 130
142MODULE_LICENSE("GPL"); 131MODULE_LICENSE("GPL");
143MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); 132MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 48c166f0d764..5db4ab52061e 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -821,30 +821,5 @@ static struct usb_driver ld_usb_driver = {
821 .id_table = ld_usb_table, 821 .id_table = ld_usb_table,
822}; 822};
823 823
824/** 824module_usb_driver(ld_usb_driver);
825 * ld_usb_init
826 */
827static int __init ld_usb_init(void)
828{
829 int retval;
830
831 /* register this driver with the USB subsystem */
832 retval = usb_register(&ld_usb_driver);
833 if (retval)
834 err("usb_register failed for the %s driver. Error number %d\n", __FILE__, retval);
835
836 return retval;
837}
838
839/**
840 * ld_usb_exit
841 */
842static void __exit ld_usb_exit(void)
843{
844 /* deregister this driver with the USB subsystem */
845 usb_deregister(&ld_usb_driver);
846}
847
848module_init(ld_usb_init);
849module_exit(ld_usb_exit);
850 825
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index a989356f693e..16937da31cd8 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -1043,51 +1043,7 @@ static void tower_disconnect (struct usb_interface *interface)
1043 dbg(2, "%s: leave", __func__); 1043 dbg(2, "%s: leave", __func__);
1044} 1044}
1045 1045
1046 1046module_usb_driver(tower_driver);
1047
1048/**
1049 * lego_usb_tower_init
1050 */
1051static int __init lego_usb_tower_init(void)
1052{
1053 int result;
1054 int retval = 0;
1055
1056 dbg(2, "%s: enter", __func__);
1057
1058 /* register this driver with the USB subsystem */
1059 result = usb_register(&tower_driver);
1060 if (result < 0) {
1061 err("usb_register failed for the %s driver. Error number %d", __FILE__, result);
1062 retval = -1;
1063 goto exit;
1064 }
1065
1066 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1067 DRIVER_DESC "\n");
1068
1069exit:
1070 dbg(2, "%s: leave, return value %d", __func__, retval);
1071
1072 return retval;
1073}
1074
1075
1076/**
1077 * lego_usb_tower_exit
1078 */
1079static void __exit lego_usb_tower_exit(void)
1080{
1081 dbg(2, "%s: enter", __func__);
1082
1083 /* deregister this driver with the USB subsystem */
1084 usb_deregister (&tower_driver);
1085
1086 dbg(2, "%s: leave", __func__);
1087}
1088
1089module_init (lego_usb_tower_init);
1090module_exit (lego_usb_tower_exit);
1091 1047
1092MODULE_AUTHOR(DRIVER_AUTHOR); 1048MODULE_AUTHOR(DRIVER_AUTHOR);
1093MODULE_DESCRIPTION(DRIVER_DESC); 1049MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
index 4e23d3841b43..487a8ce0775e 100644
--- a/drivers/usb/misc/rio500.c
+++ b/drivers/usb/misc/rio500.c
@@ -531,33 +531,7 @@ static struct usb_driver rio_driver = {
531 .id_table = rio_table, 531 .id_table = rio_table,
532}; 532};
533 533
534static int __init usb_rio_init(void) 534module_usb_driver(rio_driver);
535{
536 int retval;
537 retval = usb_register(&rio_driver);
538 if (retval)
539 goto out;
540
541 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
542 DRIVER_DESC "\n");
543
544out:
545 return retval;
546}
547
548
549static void __exit usb_rio_cleanup(void)
550{
551 struct rio_usb_data *rio = &rio_instance;
552
553 rio->present = 0;
554 usb_deregister(&rio_driver);
555
556
557}
558
559module_init(usb_rio_init);
560module_exit(usb_rio_cleanup);
561 535
562MODULE_AUTHOR( DRIVER_AUTHOR ); 536MODULE_AUTHOR( DRIVER_AUTHOR );
563MODULE_DESCRIPTION( DRIVER_DESC ); 537MODULE_DESCRIPTION( DRIVER_DESC );
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c
index f63776a48e2a..741efed4a236 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -137,26 +137,7 @@ static struct usb_driver tv_driver = {
137 .id_table = id_table, 137 .id_table = id_table,
138}; 138};
139 139
140static int __init tv_init(void) 140module_usb_driver(tv_driver);
141{
142 int retval = usb_register(&tv_driver);
143 if (retval) {
144 err("usb_register failed. Error number %d", retval);
145 return retval;
146 }
147
148 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
149 DRIVER_DESC "\n");
150 return 0;
151}
152
153static void __exit tv_exit(void)
154{
155 usb_deregister(&tv_driver);
156}
157
158module_init (tv_init);
159module_exit (tv_exit);
160 141
161MODULE_AUTHOR(DRIVER_AUTHOR); 142MODULE_AUTHOR(DRIVER_AUTHOR);
162MODULE_DESCRIPTION(DRIVER_DESC); 143MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 1871cdf10da3..e2b4bd31c2b6 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -450,25 +450,7 @@ static struct usb_driver lcd_driver = {
450 .supports_autosuspend = 1, 450 .supports_autosuspend = 1,
451}; 451};
452 452
453static int __init usb_lcd_init(void) 453module_usb_driver(lcd_driver);
454{
455 int result;
456
457 result = usb_register(&lcd_driver);
458 if (result)
459 err("usb_register failed. Error number %d", result);
460
461 return result;
462}
463
464
465static void __exit usb_lcd_exit(void)
466{
467 usb_deregister(&lcd_driver);
468}
469
470module_init(usb_lcd_init);
471module_exit(usb_lcd_exit);
472 454
473MODULE_AUTHOR("Georges Toth <g.toth@e-biz.lu>"); 455MODULE_AUTHOR("Georges Toth <g.toth@e-biz.lu>");
474MODULE_DESCRIPTION(DRIVER_VERSION); 456MODULE_DESCRIPTION(DRIVER_VERSION);
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
index 43f84e50d514..4af56fbc3c06 100644
--- a/drivers/usb/misc/usbled.c
+++ b/drivers/usb/misc/usbled.c
@@ -231,23 +231,7 @@ static struct usb_driver led_driver = {
231 .id_table = id_table, 231 .id_table = id_table,
232}; 232};
233 233
234static int __init usb_led_init(void) 234module_usb_driver(led_driver);
235{
236 int retval = 0;
237
238 retval = usb_register(&led_driver);
239 if (retval)
240 err("usb_register failed. Error number %d", retval);
241 return retval;
242}
243
244static void __exit usb_led_exit(void)
245{
246 usb_deregister(&led_driver);
247}
248
249module_init(usb_led_init);
250module_exit(usb_led_exit);
251 235
252MODULE_AUTHOR(DRIVER_AUTHOR); 236MODULE_AUTHOR(DRIVER_AUTHOR);
253MODULE_DESCRIPTION(DRIVER_DESC); 237MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index 417b8f207e8b..107bf13b1cf1 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -437,23 +437,7 @@ static struct usb_driver sevseg_driver = {
437 .supports_autosuspend = 1, 437 .supports_autosuspend = 1,
438}; 438};
439 439
440static int __init usb_sevseg_init(void) 440module_usb_driver(sevseg_driver);
441{
442 int rc = 0;
443
444 rc = usb_register(&sevseg_driver);
445 if (rc)
446 err("usb_register failed. Error number %d", rc);
447 return rc;
448}
449
450static void __exit usb_sevseg_exit(void)
451{
452 usb_deregister(&sevseg_driver);
453}
454
455module_init(usb_sevseg_init);
456module_exit(usb_sevseg_exit);
457 441
458MODULE_AUTHOR(DRIVER_AUTHOR); 442MODULE_AUTHOR(DRIVER_AUTHOR);
459MODULE_DESCRIPTION(DRIVER_DESC); 443MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index ac5bfd619e62..897edda42270 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -539,26 +539,6 @@ static const struct file_operations yurex_fops = {
539 .llseek = default_llseek, 539 .llseek = default_llseek,
540}; 540};
541 541
542 542module_usb_driver(yurex_driver);
543static int __init usb_yurex_init(void)
544{
545 int result;
546
547 /* register this driver with the USB subsystem */
548 result = usb_register(&yurex_driver);
549 if (result)
550 err("usb_register failed. Error number %d", result);
551
552 return result;
553}
554
555static void __exit usb_yurex_exit(void)
556{
557 /* deregister this driver with the USB subsystem */
558 usb_deregister(&yurex_driver);
559}
560
561module_init(usb_yurex_init);
562module_exit(usb_yurex_exit);
563 543
564MODULE_LICENSE("GPL"); 544MODULE_LICENSE("GPL");
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 42d0eaed4a01..3ca87a823342 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -1278,15 +1278,4 @@ static struct usb_driver alauda_driver = {
1278 .soft_unbind = 1, 1278 .soft_unbind = 1,
1279}; 1279};
1280 1280
1281static int __init alauda_init(void) 1281module_usb_driver(alauda_driver);
1282{
1283 return usb_register(&alauda_driver);
1284}
1285
1286static void __exit alauda_exit(void)
1287{
1288 usb_deregister(&alauda_driver);
1289}
1290
1291module_init(alauda_init);
1292module_exit(alauda_exit);
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index c84471821183..c7909dfa2434 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -274,15 +274,4 @@ static struct usb_driver cypress_driver = {
274 .soft_unbind = 1, 274 .soft_unbind = 1,
275}; 275};
276 276
277static int __init cypress_init(void) 277module_usb_driver(cypress_driver);
278{
279 return usb_register(&cypress_driver);
280}
281
282static void __exit cypress_exit(void)
283{
284 usb_deregister(&cypress_driver);
285}
286
287module_init(cypress_init);
288module_exit(cypress_exit);
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index ded836b02d7b..a99be857b794 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -753,15 +753,4 @@ static struct usb_driver datafab_driver = {
753 .soft_unbind = 1, 753 .soft_unbind = 1,
754}; 754};
755 755
756static int __init datafab_init(void) 756module_usb_driver(datafab_driver);
757{
758 return usb_register(&datafab_driver);
759}
760
761static void __exit datafab_exit(void)
762{
763 usb_deregister(&datafab_driver);
764}
765
766module_init(datafab_init);
767module_exit(datafab_exit);
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index 9fbe742343c6..b0a1687ca942 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -2409,15 +2409,4 @@ static struct usb_driver ene_ub6250_driver = {
2409 .soft_unbind = 1, 2409 .soft_unbind = 1,
2410}; 2410};
2411 2411
2412static int __init ene_ub6250_init(void) 2412module_usb_driver(ene_ub6250_driver);
2413{
2414 return usb_register(&ene_ub6250_driver);
2415}
2416
2417static void __exit ene_ub6250_exit(void)
2418{
2419 usb_deregister(&ene_ub6250_driver);
2420}
2421
2422module_init(ene_ub6250_init);
2423module_exit(ene_ub6250_exit);
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index 6542ca40d505..03d4a873748c 100644
--- a/drivers/usb/storage/freecom.c
+++ b/drivers/usb/storage/freecom.c
@@ -555,15 +555,4 @@ static struct usb_driver freecom_driver = {
555 .soft_unbind = 1, 555 .soft_unbind = 1,
556}; 556};
557 557
558static int __init freecom_init(void) 558module_usb_driver(freecom_driver);
559{
560 return usb_register(&freecom_driver);
561}
562
563static void __exit freecom_exit(void)
564{
565 usb_deregister(&freecom_driver);
566}
567
568module_init(freecom_init);
569module_exit(freecom_exit);
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index ffc4193e9505..6d6923317f10 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -1568,15 +1568,4 @@ static struct usb_driver isd200_driver = {
1568 .soft_unbind = 1, 1568 .soft_unbind = 1,
1569}; 1569};
1570 1570
1571static int __init isd200_init(void) 1571module_usb_driver(isd200_driver);
1572{
1573 return usb_register(&isd200_driver);
1574}
1575
1576static void __exit isd200_exit(void)
1577{
1578 usb_deregister(&isd200_driver);
1579}
1580
1581module_init(isd200_init);
1582module_exit(isd200_exit);
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index 6168596c5ac6..54b71650b69c 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -679,15 +679,4 @@ static struct usb_driver jumpshot_driver = {
679 .soft_unbind = 1, 679 .soft_unbind = 1,
680}; 680};
681 681
682static int __init jumpshot_init(void) 682module_usb_driver(jumpshot_driver);
683{
684 return usb_register(&jumpshot_driver);
685}
686
687static void __exit jumpshot_exit(void)
688{
689 usb_deregister(&jumpshot_driver);
690}
691
692module_init(jumpshot_init);
693module_exit(jumpshot_exit);
diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
index ba1b78906880..35181e29124d 100644
--- a/drivers/usb/storage/karma.c
+++ b/drivers/usb/storage/karma.c
@@ -232,15 +232,4 @@ static struct usb_driver karma_driver = {
232 .soft_unbind = 1, 232 .soft_unbind = 1,
233}; 233};
234 234
235static int __init karma_init(void) 235module_usb_driver(karma_driver);
236{
237 return usb_register(&karma_driver);
238}
239
240static void __exit karma_exit(void)
241{
242 usb_deregister(&karma_driver);
243}
244
245module_init(karma_init);
246module_exit(karma_exit);
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index 1943be5a2914..721c8c587305 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -314,15 +314,4 @@ static struct usb_driver onetouch_driver = {
314 .soft_unbind = 1, 314 .soft_unbind = 1,
315}; 315};
316 316
317static int __init onetouch_init(void) 317module_usb_driver(onetouch_driver);
318{
319 return usb_register(&onetouch_driver);
320}
321
322static void __exit onetouch_exit(void)
323{
324 usb_deregister(&onetouch_driver);
325}
326
327module_init(onetouch_init);
328module_exit(onetouch_exit);
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 0ce5f79197e7..c41cd30d2c01 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -1104,15 +1104,4 @@ static struct usb_driver realtek_cr_driver = {
1104 .supports_autosuspend = 1, 1104 .supports_autosuspend = 1,
1105}; 1105};
1106 1106
1107static int __init realtek_cr_init(void) 1107module_usb_driver(realtek_cr_driver);
1108{
1109 return usb_register(&realtek_cr_driver);
1110}
1111
1112static void __exit realtek_cr_exit(void)
1113{
1114 usb_deregister(&realtek_cr_driver);
1115}
1116
1117module_init(realtek_cr_init);
1118module_exit(realtek_cr_exit);
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index bcb9a709d349..83ee49e737bd 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -1789,15 +1789,4 @@ static struct usb_driver sddr09_driver = {
1789 .soft_unbind = 1, 1789 .soft_unbind = 1,
1790}; 1790};
1791 1791
1792static int __init sddr09_init(void) 1792module_usb_driver(sddr09_driver);
1793{
1794 return usb_register(&sddr09_driver);
1795}
1796
1797static void __exit sddr09_exit(void)
1798{
1799 usb_deregister(&sddr09_driver);
1800}
1801
1802module_init(sddr09_init);
1803module_exit(sddr09_exit);
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index 44dfed7754ed..8983ec2ffb5a 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -1008,15 +1008,4 @@ static struct usb_driver sddr55_driver = {
1008 .soft_unbind = 1, 1008 .soft_unbind = 1,
1009}; 1009};
1010 1010
1011static int __init sddr55_init(void) 1011module_usb_driver(sddr55_driver);
1012{
1013 return usb_register(&sddr55_driver);
1014}
1015
1016static void __exit sddr55_exit(void)
1017{
1018 usb_deregister(&sddr55_driver);
1019}
1020
1021module_init(sddr55_init);
1022module_exit(sddr55_exit);
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index 0b00091d2ae9..a4c02751af4e 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -1865,15 +1865,4 @@ static struct usb_driver usbat_driver = {
1865 .soft_unbind = 1, 1865 .soft_unbind = 1,
1866}; 1866};
1867 1867
1868static int __init usbat_init(void) 1868module_usb_driver(usbat_driver);
1869{
1870 return usb_register(&usbat_driver);
1871}
1872
1873static void __exit usbat_exit(void)
1874{
1875 usb_deregister(&usbat_driver);
1876}
1877
1878module_init(usbat_init);
1879module_exit(usbat_exit);
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 1d10d5b8204c..a33ead5dce20 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -760,18 +760,7 @@ static struct usb_driver uas_driver = {
760 .id_table = uas_usb_ids, 760 .id_table = uas_usb_ids,
761}; 761};
762 762
763static int uas_init(void) 763module_usb_driver(uas_driver);
764{
765 return usb_register(&uas_driver);
766}
767
768static void uas_exit(void)
769{
770 usb_deregister(&uas_driver);
771}
772
773module_init(uas_init);
774module_exit(uas_exit);
775 764
776MODULE_LICENSE("GPL"); 765MODULE_LICENSE("GPL");
777MODULE_AUTHOR("Matthew Wilcox and Sarah Sharp"); 766MODULE_AUTHOR("Matthew Wilcox and Sarah Sharp");
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 32d6fc953904..5c6c1bdbd455 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -688,25 +688,6 @@ static struct usb_driver skel_driver = {
688 .supports_autosuspend = 1, 688 .supports_autosuspend = 1,
689}; 689};
690 690
691static int __init usb_skel_init(void) 691module_usb_driver(skel_driver);
692{
693 int result;
694
695 /* register this driver with the USB subsystem */
696 result = usb_register(&skel_driver);
697 if (result)
698 err("usb_register failed. Error number %d", result);
699
700 return result;
701}
702
703static void __exit usb_skel_exit(void)
704{
705 /* deregister this driver with the USB subsystem */
706 usb_deregister(&skel_driver);
707}
708
709module_init(usb_skel_init);
710module_exit(usb_skel_exit);
711 692
712MODULE_LICENSE("GPL"); 693MODULE_LICENSE("GPL");
diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c
index 200fd7c6c7d5..7f78f300f8fb 100644
--- a/drivers/usb/wusbcore/cbaf.c
+++ b/drivers/usb/wusbcore/cbaf.c
@@ -655,17 +655,7 @@ static struct usb_driver cbaf_driver = {
655 .disconnect = cbaf_disconnect, 655 .disconnect = cbaf_disconnect,
656}; 656};
657 657
658static int __init cbaf_driver_init(void) 658module_usb_driver(cbaf_driver);
659{
660 return usb_register(&cbaf_driver);
661}
662module_init(cbaf_driver_init);
663
664static void __exit cbaf_driver_exit(void)
665{
666 usb_deregister(&cbaf_driver);
667}
668module_exit(cbaf_driver_exit);
669 659
670MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); 660MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
671MODULE_DESCRIPTION("Wireless USB Cable Based Association"); 661MODULE_DESCRIPTION("Wireless USB Cable Based Association");
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 2babcd4fbfc1..66797e9c5010 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -914,17 +914,7 @@ static struct usb_driver hwarc_driver = {
914 .post_reset = hwarc_post_reset, 914 .post_reset = hwarc_post_reset,
915}; 915};
916 916
917static int __init hwarc_driver_init(void) 917module_usb_driver(hwarc_driver);
918{
919 return usb_register(&hwarc_driver);
920}
921module_init(hwarc_driver_init);
922
923static void __exit hwarc_driver_exit(void)
924{
925 usb_deregister(&hwarc_driver);
926}
927module_exit(hwarc_driver_exit);
928 918
929MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); 919MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
930MODULE_DESCRIPTION("Host Wireless Adapter Radio Control Driver"); 920MODULE_DESCRIPTION("Host Wireless Adapter Radio Control Driver");
diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
index ba8664328afa..c8f684833d58 100644
--- a/drivers/uwb/i1480/dfu/usb.c
+++ b/drivers/uwb/i1480/dfu/usb.c
@@ -451,25 +451,7 @@ static struct usb_driver i1480_dfu_driver = {
451 .disconnect = NULL, 451 .disconnect = NULL,
452}; 452};
453 453
454 454module_usb_driver(i1480_dfu_driver);
455/*
456 * Initialize the i1480 DFU driver.
457 *
458 * We also need to register our function for guessing event sizes.
459 */
460static int __init i1480_dfu_driver_init(void)
461{
462 return usb_register(&i1480_dfu_driver);
463}
464module_init(i1480_dfu_driver_init);
465
466
467static void __exit i1480_dfu_driver_exit(void)
468{
469 usb_deregister(&i1480_dfu_driver);
470}
471module_exit(i1480_dfu_driver_exit);
472
473 455
474MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); 456MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
475MODULE_DESCRIPTION("Intel Wireless UWB Link 1480 firmware uploader for USB"); 457MODULE_DESCRIPTION("Intel Wireless UWB Link 1480 firmware uploader for USB");
diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c
index aaccffac67ab..3c22994ea31a 100644
--- a/drivers/video/smscufx.c
+++ b/drivers/video/smscufx.c
@@ -1792,24 +1792,7 @@ static struct usb_driver ufx_driver = {
1792 .id_table = id_table, 1792 .id_table = id_table,
1793}; 1793};
1794 1794
1795static int __init ufx_module_init(void) 1795module_usb_driver(ufx_driver);
1796{
1797 int res;
1798
1799 res = usb_register(&ufx_driver);
1800 if (res)
1801 err("usb_register failed. Error number %d", res);
1802
1803 return res;
1804}
1805
1806static void __exit ufx_module_exit(void)
1807{
1808 usb_deregister(&ufx_driver);
1809}
1810
1811module_init(ufx_module_init);
1812module_exit(ufx_module_exit);
1813 1796
1814static void ufx_urb_completion(struct urb *urb) 1797static void ufx_urb_completion(struct urb *urb)
1815{ 1798{
diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
index 3473e75ce785..1f868d0187a2 100644
--- a/drivers/video/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -1761,24 +1761,7 @@ static struct usb_driver dlfb_driver = {
1761 .id_table = id_table, 1761 .id_table = id_table,
1762}; 1762};
1763 1763
1764static int __init dlfb_module_init(void) 1764module_usb_driver(dlfb_driver);
1765{
1766 int res;
1767
1768 res = usb_register(&dlfb_driver);
1769 if (res)
1770 err("usb_register failed. Error number %d", res);
1771
1772 return res;
1773}
1774
1775static void __exit dlfb_module_exit(void)
1776{
1777 usb_deregister(&dlfb_driver);
1778}
1779
1780module_init(dlfb_module_init);
1781module_exit(dlfb_module_exit);
1782 1765
1783static void dlfb_urb_completion(struct urb *urb) 1766static void dlfb_urb_completion(struct urb *urb)
1784{ 1767{
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index b5abaae38e97..4f7e1d770f81 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -1002,26 +1002,7 @@ static void ds_disconnect(struct usb_interface *intf)
1002 kfree(dev); 1002 kfree(dev);
1003} 1003}
1004 1004
1005static int ds_init(void) 1005module_usb_driver(ds_driver);
1006{
1007 int err;
1008
1009 err = usb_register(&ds_driver);
1010 if (err) {
1011 printk(KERN_INFO "Failed to register DS9490R USB device: err=%d.\n", err);
1012 return err;
1013 }
1014
1015 return 0;
1016}
1017
1018static void ds_fini(void)
1019{
1020 usb_deregister(&ds_driver);
1021}
1022
1023module_init(ds_init);
1024module_exit(ds_fini);
1025 1006
1026MODULE_LICENSE("GPL"); 1007MODULE_LICENSE("GPL");
1027MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); 1008MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>");
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index a1ef9b5b38cf..ff29ae747ee8 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -175,11 +175,13 @@ static ssize_t w1_therm_read(struct device *device,
175{ 175{
176 struct w1_slave *sl = dev_to_w1_slave(device); 176 struct w1_slave *sl = dev_to_w1_slave(device);
177 struct w1_master *dev = sl->master; 177 struct w1_master *dev = sl->master;
178 u8 rom[9], crc, verdict; 178 u8 rom[9], crc, verdict, external_power;
179 int i, max_trying = 10; 179 int i, max_trying = 10;
180 ssize_t c = PAGE_SIZE; 180 ssize_t c = PAGE_SIZE;
181 181
182 mutex_lock(&dev->mutex); 182 i = mutex_lock_interruptible(&dev->mutex);
183 if (i != 0)
184 return i;
183 185
184 memset(rom, 0, sizeof(rom)); 186 memset(rom, 0, sizeof(rom));
185 187
@@ -190,13 +192,37 @@ static ssize_t w1_therm_read(struct device *device,
190 if (!w1_reset_select_slave(sl)) { 192 if (!w1_reset_select_slave(sl)) {
191 int count = 0; 193 int count = 0;
192 unsigned int tm = 750; 194 unsigned int tm = 750;
195 unsigned long sleep_rem;
196
197 w1_write_8(dev, W1_READ_PSUPPLY);
198 external_power = w1_read_8(dev);
199
200 if (w1_reset_select_slave(sl))
201 continue;
193 202
194 /* 750ms strong pullup (or delay) after the convert */ 203 /* 750ms strong pullup (or delay) after the convert */
195 if (w1_strong_pullup) 204 if (!external_power && w1_strong_pullup)
196 w1_next_pullup(dev, tm); 205 w1_next_pullup(dev, tm);
206
197 w1_write_8(dev, W1_CONVERT_TEMP); 207 w1_write_8(dev, W1_CONVERT_TEMP);
198 if (!w1_strong_pullup) 208
199 msleep(tm); 209 if (external_power) {
210 mutex_unlock(&dev->mutex);
211
212 sleep_rem = msleep_interruptible(tm);
213 if (sleep_rem != 0)
214 return -EINTR;
215
216 i = mutex_lock_interruptible(&dev->mutex);
217 if (i != 0)
218 return i;
219 } else if (!w1_strong_pullup) {
220 sleep_rem = msleep_interruptible(tm);
221 if (sleep_rem != 0) {
222 mutex_unlock(&dev->mutex);
223 return -EINTR;
224 }
225 }
200 226
201 if (!w1_reset_select_slave(sl)) { 227 if (!w1_reset_select_slave(sl)) {
202 228
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index c37497823851..9761950697b4 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -892,6 +892,16 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
892 break; 892 break;
893 } 893 }
894 894
895 /* Do fast search on single slave bus */
896 if (dev->max_slave_count == 1) {
897 w1_write_8(dev, W1_READ_ROM);
898
899 if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn)
900 cb(dev, rn);
901
902 break;
903 }
904
895 /* Start the search */ 905 /* Start the search */
896 w1_write_8(dev, search_type); 906 w1_write_8(dev, search_type);
897 for (i = 0; i < 64; ++i) { 907 for (i = 0; i < 64; ++i) {
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 748a74bd85e7..d8de1ddd176a 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -827,37 +827,4 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
827 printk(KERN_INFO PFX "USB PC Watchdog disconnected\n"); 827 printk(KERN_INFO PFX "USB PC Watchdog disconnected\n");
828} 828}
829 829
830 830module_usb_driver(usb_pcwd_driver);
831
832/**
833 * usb_pcwd_init
834 */
835static int __init usb_pcwd_init(void)
836{
837 int result;
838
839 /* register this driver with the USB subsystem */
840 result = usb_register(&usb_pcwd_driver);
841 if (result) {
842 printk(KERN_ERR PFX "usb_register failed. Error number %d\n",
843 result);
844 return result;
845 }
846
847 printk(KERN_INFO PFX DRIVER_DESC " v" DRIVER_VERSION "\n");
848 return 0;
849}
850
851
852/**
853 * usb_pcwd_exit
854 */
855static void __exit usb_pcwd_exit(void)
856{
857 /* deregister this driver with the USB subsystem */
858 usb_deregister(&usb_pcwd_driver);
859}
860
861
862module_init(usb_pcwd_init);
863module_exit(usb_pcwd_exit);
diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
index 9cc2259c9992..3832e303c33a 100644
--- a/drivers/xen/xen-balloon.c
+++ b/drivers/xen/xen-balloon.c
@@ -32,7 +32,6 @@
32 32
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/sysdev.h>
36#include <linux/capability.h> 35#include <linux/capability.h>
37 36
38#include <xen/xen.h> 37#include <xen/xen.h>
@@ -46,9 +45,9 @@
46 45
47#define BALLOON_CLASS_NAME "xen_memory" 46#define BALLOON_CLASS_NAME "xen_memory"
48 47
49static struct sys_device balloon_sysdev; 48static struct device balloon_dev;
50 49
51static int register_balloon(struct sys_device *sysdev); 50static int register_balloon(struct device *dev);
52 51
53/* React to a change in the target key */ 52/* React to a change in the target key */
54static void watch_target(struct xenbus_watch *watch, 53static void watch_target(struct xenbus_watch *watch,
@@ -98,9 +97,9 @@ static int __init balloon_init(void)
98 97
99 pr_info("xen-balloon: Initialising balloon driver.\n"); 98 pr_info("xen-balloon: Initialising balloon driver.\n");
100 99
101 register_balloon(&balloon_sysdev); 100 register_balloon(&balloon_dev);
102 101
103 register_xen_selfballooning(&balloon_sysdev); 102 register_xen_selfballooning(&balloon_dev);
104 103
105 register_xenstore_notifier(&xenstore_notifier); 104 register_xenstore_notifier(&xenstore_notifier);
106 105
@@ -117,31 +116,31 @@ static void balloon_exit(void)
117module_exit(balloon_exit); 116module_exit(balloon_exit);
118 117
119#define BALLOON_SHOW(name, format, args...) \ 118#define BALLOON_SHOW(name, format, args...) \
120 static ssize_t show_##name(struct sys_device *dev, \ 119 static ssize_t show_##name(struct device *dev, \
121 struct sysdev_attribute *attr, \ 120 struct device_attribute *attr, \
122 char *buf) \ 121 char *buf) \
123 { \ 122 { \
124 return sprintf(buf, format, ##args); \ 123 return sprintf(buf, format, ##args); \
125 } \ 124 } \
126 static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL) 125 static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
127 126
128BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages)); 127BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
129BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low)); 128BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
130BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high)); 129BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
131 130
132static SYSDEV_ULONG_ATTR(schedule_delay, 0444, balloon_stats.schedule_delay); 131static DEVICE_ULONG_ATTR(schedule_delay, 0444, balloon_stats.schedule_delay);
133static SYSDEV_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay); 132static DEVICE_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay);
134static SYSDEV_ULONG_ATTR(retry_count, 0444, balloon_stats.retry_count); 133static DEVICE_ULONG_ATTR(retry_count, 0444, balloon_stats.retry_count);
135static SYSDEV_ULONG_ATTR(max_retry_count, 0644, balloon_stats.max_retry_count); 134static DEVICE_ULONG_ATTR(max_retry_count, 0644, balloon_stats.max_retry_count);
136 135
137static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr, 136static ssize_t show_target_kb(struct device *dev, struct device_attribute *attr,
138 char *buf) 137 char *buf)
139{ 138{
140 return sprintf(buf, "%lu\n", PAGES2KB(balloon_stats.target_pages)); 139 return sprintf(buf, "%lu\n", PAGES2KB(balloon_stats.target_pages));
141} 140}
142 141
143static ssize_t store_target_kb(struct sys_device *dev, 142static ssize_t store_target_kb(struct device *dev,
144 struct sysdev_attribute *attr, 143 struct device_attribute *attr,
145 const char *buf, 144 const char *buf,
146 size_t count) 145 size_t count)
147{ 146{
@@ -158,11 +157,11 @@ static ssize_t store_target_kb(struct sys_device *dev,
158 return count; 157 return count;
159} 158}
160 159
161static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR, 160static DEVICE_ATTR(target_kb, S_IRUGO | S_IWUSR,
162 show_target_kb, store_target_kb); 161 show_target_kb, store_target_kb);
163 162
164 163
165static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr, 164static ssize_t show_target(struct device *dev, struct device_attribute *attr,
166 char *buf) 165 char *buf)
167{ 166{
168 return sprintf(buf, "%llu\n", 167 return sprintf(buf, "%llu\n",
@@ -170,8 +169,8 @@ static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr
170 << PAGE_SHIFT); 169 << PAGE_SHIFT);
171} 170}
172 171
173static ssize_t store_target(struct sys_device *dev, 172static ssize_t store_target(struct device *dev,
174 struct sysdev_attribute *attr, 173 struct device_attribute *attr,
175 const char *buf, 174 const char *buf,
176 size_t count) 175 size_t count)
177{ 176{
@@ -188,23 +187,23 @@ static ssize_t store_target(struct sys_device *dev,
188 return count; 187 return count;
189} 188}
190 189
191static SYSDEV_ATTR(target, S_IRUGO | S_IWUSR, 190static DEVICE_ATTR(target, S_IRUGO | S_IWUSR,
192 show_target, store_target); 191 show_target, store_target);
193 192
194 193
195static struct sysdev_attribute *balloon_attrs[] = { 194static struct device_attribute *balloon_attrs[] = {
196 &attr_target_kb, 195 &dev_attr_target_kb,
197 &attr_target, 196 &dev_attr_target,
198 &attr_schedule_delay.attr, 197 &dev_attr_schedule_delay.attr,
199 &attr_max_schedule_delay.attr, 198 &dev_attr_max_schedule_delay.attr,
200 &attr_retry_count.attr, 199 &dev_attr_retry_count.attr,
201 &attr_max_retry_count.attr 200 &dev_attr_max_retry_count.attr
202}; 201};
203 202
204static struct attribute *balloon_info_attrs[] = { 203static struct attribute *balloon_info_attrs[] = {
205 &attr_current_kb.attr, 204 &dev_attr_current_kb.attr,
206 &attr_low_kb.attr, 205 &dev_attr_low_kb.attr,
207 &attr_high_kb.attr, 206 &dev_attr_high_kb.attr,
208 NULL 207 NULL
209}; 208};
210 209
@@ -213,34 +212,35 @@ static struct attribute_group balloon_info_group = {
213 .attrs = balloon_info_attrs 212 .attrs = balloon_info_attrs
214}; 213};
215 214
216static struct sysdev_class balloon_sysdev_class = { 215static struct bus_type balloon_subsys = {
217 .name = BALLOON_CLASS_NAME 216 .name = BALLOON_CLASS_NAME,
217 .dev_name = BALLOON_CLASS_NAME,
218}; 218};
219 219
220static int register_balloon(struct sys_device *sysdev) 220static int register_balloon(struct device *dev)
221{ 221{
222 int i, error; 222 int i, error;
223 223
224 error = sysdev_class_register(&balloon_sysdev_class); 224 error = bus_register(&balloon_subsys);
225 if (error) 225 if (error)
226 return error; 226 return error;
227 227
228 sysdev->id = 0; 228 dev->id = 0;
229 sysdev->cls = &balloon_sysdev_class; 229 dev->bus = &balloon_subsys;
230 230
231 error = sysdev_register(sysdev); 231 error = device_register(dev);
232 if (error) { 232 if (error) {
233 sysdev_class_unregister(&balloon_sysdev_class); 233 bus_unregister(&balloon_subsys);
234 return error; 234 return error;
235 } 235 }
236 236
237 for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++) { 237 for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++) {
238 error = sysdev_create_file(sysdev, balloon_attrs[i]); 238 error = device_create_file(dev, balloon_attrs[i]);
239 if (error) 239 if (error)
240 goto fail; 240 goto fail;
241 } 241 }
242 242
243 error = sysfs_create_group(&sysdev->kobj, &balloon_info_group); 243 error = sysfs_create_group(&dev->kobj, &balloon_info_group);
244 if (error) 244 if (error)
245 goto fail; 245 goto fail;
246 246
@@ -248,9 +248,9 @@ static int register_balloon(struct sys_device *sysdev)
248 248
249 fail: 249 fail:
250 while (--i >= 0) 250 while (--i >= 0)
251 sysdev_remove_file(sysdev, balloon_attrs[i]); 251 device_remove_file(dev, balloon_attrs[i]);
252 sysdev_unregister(sysdev); 252 device_unregister(dev);
253 sysdev_class_unregister(&balloon_sysdev_class); 253 bus_unregister(&balloon_subsys);
254 return error; 254 return error;
255} 255}
256 256
diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c
index d93c70857e03..767ff656d5a7 100644
--- a/drivers/xen/xen-selfballoon.c
+++ b/drivers/xen/xen-selfballoon.c
@@ -74,6 +74,7 @@
74#include <linux/mman.h> 74#include <linux/mman.h>
75#include <linux/module.h> 75#include <linux/module.h>
76#include <linux/workqueue.h> 76#include <linux/workqueue.h>
77#include <linux/device.h>
77#include <xen/balloon.h> 78#include <xen/balloon.h>
78#include <xen/tmem.h> 79#include <xen/tmem.h>
79#include <xen/xen.h> 80#include <xen/xen.h>
@@ -266,21 +267,20 @@ static void selfballoon_process(struct work_struct *work)
266 267
267#ifdef CONFIG_SYSFS 268#ifdef CONFIG_SYSFS
268 269
269#include <linux/sysdev.h>
270#include <linux/capability.h> 270#include <linux/capability.h>
271 271
272#define SELFBALLOON_SHOW(name, format, args...) \ 272#define SELFBALLOON_SHOW(name, format, args...) \
273 static ssize_t show_##name(struct sys_device *dev, \ 273 static ssize_t show_##name(struct device *dev, \
274 struct sysdev_attribute *attr, \ 274 struct device_attribute *attr, \
275 char *buf) \ 275 char *buf) \
276 { \ 276 { \
277 return sprintf(buf, format, ##args); \ 277 return sprintf(buf, format, ##args); \
278 } 278 }
279 279
280SELFBALLOON_SHOW(selfballooning, "%d\n", xen_selfballooning_enabled); 280SELFBALLOON_SHOW(selfballooning, "%d\n", xen_selfballooning_enabled);
281 281
282static ssize_t store_selfballooning(struct sys_device *dev, 282static ssize_t store_selfballooning(struct device *dev,
283 struct sysdev_attribute *attr, 283 struct device_attribute *attr,
284 const char *buf, 284 const char *buf,
285 size_t count) 285 size_t count)
286{ 286{
@@ -303,13 +303,13 @@ static ssize_t store_selfballooning(struct sys_device *dev,
303 return count; 303 return count;
304} 304}
305 305
306static SYSDEV_ATTR(selfballooning, S_IRUGO | S_IWUSR, 306static DEVICE_ATTR(selfballooning, S_IRUGO | S_IWUSR,
307 show_selfballooning, store_selfballooning); 307 show_selfballooning, store_selfballooning);
308 308
309SELFBALLOON_SHOW(selfballoon_interval, "%d\n", selfballoon_interval); 309SELFBALLOON_SHOW(selfballoon_interval, "%d\n", selfballoon_interval);
310 310
311static ssize_t store_selfballoon_interval(struct sys_device *dev, 311static ssize_t store_selfballoon_interval(struct device *dev,
312 struct sysdev_attribute *attr, 312 struct device_attribute *attr,
313 const char *buf, 313 const char *buf,
314 size_t count) 314 size_t count)
315{ 315{
@@ -325,13 +325,13 @@ static ssize_t store_selfballoon_interval(struct sys_device *dev,
325 return count; 325 return count;
326} 326}
327 327
328static SYSDEV_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR, 328static DEVICE_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR,
329 show_selfballoon_interval, store_selfballoon_interval); 329 show_selfballoon_interval, store_selfballoon_interval);
330 330
331SELFBALLOON_SHOW(selfballoon_downhys, "%d\n", selfballoon_downhysteresis); 331SELFBALLOON_SHOW(selfballoon_downhys, "%d\n", selfballoon_downhysteresis);
332 332
333static ssize_t store_selfballoon_downhys(struct sys_device *dev, 333static ssize_t store_selfballoon_downhys(struct device *dev,
334 struct sysdev_attribute *attr, 334 struct device_attribute *attr,
335 const char *buf, 335 const char *buf,
336 size_t count) 336 size_t count)
337{ 337{
@@ -347,14 +347,14 @@ static ssize_t store_selfballoon_downhys(struct sys_device *dev,
347 return count; 347 return count;
348} 348}
349 349
350static SYSDEV_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR, 350static DEVICE_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR,
351 show_selfballoon_downhys, store_selfballoon_downhys); 351 show_selfballoon_downhys, store_selfballoon_downhys);
352 352
353 353
354SELFBALLOON_SHOW(selfballoon_uphys, "%d\n", selfballoon_uphysteresis); 354SELFBALLOON_SHOW(selfballoon_uphys, "%d\n", selfballoon_uphysteresis);
355 355
356static ssize_t store_selfballoon_uphys(struct sys_device *dev, 356static ssize_t store_selfballoon_uphys(struct device *dev,
357 struct sysdev_attribute *attr, 357 struct device_attribute *attr,
358 const char *buf, 358 const char *buf,
359 size_t count) 359 size_t count)
360{ 360{
@@ -370,14 +370,14 @@ static ssize_t store_selfballoon_uphys(struct sys_device *dev,
370 return count; 370 return count;
371} 371}
372 372
373static SYSDEV_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR, 373static DEVICE_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR,
374 show_selfballoon_uphys, store_selfballoon_uphys); 374 show_selfballoon_uphys, store_selfballoon_uphys);
375 375
376SELFBALLOON_SHOW(selfballoon_min_usable_mb, "%d\n", 376SELFBALLOON_SHOW(selfballoon_min_usable_mb, "%d\n",
377 selfballoon_min_usable_mb); 377 selfballoon_min_usable_mb);
378 378
379static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev, 379static ssize_t store_selfballoon_min_usable_mb(struct device *dev,
380 struct sysdev_attribute *attr, 380 struct device_attribute *attr,
381 const char *buf, 381 const char *buf,
382 size_t count) 382 size_t count)
383{ 383{
@@ -393,7 +393,7 @@ static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev,
393 return count; 393 return count;
394} 394}
395 395
396static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, 396static DEVICE_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR,
397 show_selfballoon_min_usable_mb, 397 show_selfballoon_min_usable_mb,
398 store_selfballoon_min_usable_mb); 398 store_selfballoon_min_usable_mb);
399 399
@@ -401,8 +401,8 @@ static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR,
401#ifdef CONFIG_FRONTSWAP 401#ifdef CONFIG_FRONTSWAP
402SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking); 402SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking);
403 403
404static ssize_t store_frontswap_selfshrinking(struct sys_device *dev, 404static ssize_t store_frontswap_selfshrinking(struct device *dev,
405 struct sysdev_attribute *attr, 405 struct device_attribute *attr,
406 const char *buf, 406 const char *buf,
407 size_t count) 407 size_t count)
408{ 408{
@@ -424,13 +424,13 @@ static ssize_t store_frontswap_selfshrinking(struct sys_device *dev,
424 return count; 424 return count;
425} 425}
426 426
427static SYSDEV_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR, 427static DEVICE_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR,
428 show_frontswap_selfshrinking, store_frontswap_selfshrinking); 428 show_frontswap_selfshrinking, store_frontswap_selfshrinking);
429 429
430SELFBALLOON_SHOW(frontswap_inertia, "%d\n", frontswap_inertia); 430SELFBALLOON_SHOW(frontswap_inertia, "%d\n", frontswap_inertia);
431 431
432static ssize_t store_frontswap_inertia(struct sys_device *dev, 432static ssize_t store_frontswap_inertia(struct device *dev,
433 struct sysdev_attribute *attr, 433 struct device_attribute *attr,
434 const char *buf, 434 const char *buf,
435 size_t count) 435 size_t count)
436{ 436{
@@ -447,13 +447,13 @@ static ssize_t store_frontswap_inertia(struct sys_device *dev,
447 return count; 447 return count;
448} 448}
449 449
450static SYSDEV_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR, 450static DEVICE_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR,
451 show_frontswap_inertia, store_frontswap_inertia); 451 show_frontswap_inertia, store_frontswap_inertia);
452 452
453SELFBALLOON_SHOW(frontswap_hysteresis, "%d\n", frontswap_hysteresis); 453SELFBALLOON_SHOW(frontswap_hysteresis, "%d\n", frontswap_hysteresis);
454 454
455static ssize_t store_frontswap_hysteresis(struct sys_device *dev, 455static ssize_t store_frontswap_hysteresis(struct device *dev,
456 struct sysdev_attribute *attr, 456 struct device_attribute *attr,
457 const char *buf, 457 const char *buf,
458 size_t count) 458 size_t count)
459{ 459{
@@ -469,21 +469,21 @@ static ssize_t store_frontswap_hysteresis(struct sys_device *dev,
469 return count; 469 return count;
470} 470}
471 471
472static SYSDEV_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR, 472static DEVICE_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR,
473 show_frontswap_hysteresis, store_frontswap_hysteresis); 473 show_frontswap_hysteresis, store_frontswap_hysteresis);
474 474
475#endif /* CONFIG_FRONTSWAP */ 475#endif /* CONFIG_FRONTSWAP */
476 476
477static struct attribute *selfballoon_attrs[] = { 477static struct attribute *selfballoon_attrs[] = {
478 &attr_selfballooning.attr, 478 &dev_attr_selfballooning.attr,
479 &attr_selfballoon_interval.attr, 479 &dev_attr_selfballoon_interval.attr,
480 &attr_selfballoon_downhysteresis.attr, 480 &dev_attr_selfballoon_downhysteresis.attr,
481 &attr_selfballoon_uphysteresis.attr, 481 &dev_attr_selfballoon_uphysteresis.attr,
482 &attr_selfballoon_min_usable_mb.attr, 482 &dev_attr_selfballoon_min_usable_mb.attr,
483#ifdef CONFIG_FRONTSWAP 483#ifdef CONFIG_FRONTSWAP
484 &attr_frontswap_selfshrinking.attr, 484 &dev_attr_frontswap_selfshrinking.attr,
485 &attr_frontswap_hysteresis.attr, 485 &dev_attr_frontswap_hysteresis.attr,
486 &attr_frontswap_inertia.attr, 486 &dev_attr_frontswap_inertia.attr,
487#endif 487#endif
488 NULL 488 NULL
489}; 489};
@@ -494,12 +494,12 @@ static struct attribute_group selfballoon_group = {
494}; 494};
495#endif 495#endif
496 496
497int register_xen_selfballooning(struct sys_device *sysdev) 497int register_xen_selfballooning(struct device *dev)
498{ 498{
499 int error = -1; 499 int error = -1;
500 500
501#ifdef CONFIG_SYSFS 501#ifdef CONFIG_SYSFS
502 error = sysfs_create_group(&sysdev->kobj, &selfballoon_group); 502 error = sysfs_create_group(&dev->kobj, &selfballoon_group);
503#endif 503#endif
504 return error; 504 return error;
505} 505}
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 90f76575c056..ea62afa4fd57 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -15,9 +15,11 @@
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/seq_file.h>
18#include <linux/pagemap.h> 19#include <linux/pagemap.h>
19#include <linux/namei.h> 20#include <linux/namei.h>
20#include <linux/debugfs.h> 21#include <linux/debugfs.h>
22#include <linux/io.h>
21 23
22static ssize_t default_read_file(struct file *file, char __user *buf, 24static ssize_t default_read_file(struct file *file, char __user *buf,
23 size_t count, loff_t *ppos) 25 size_t count, loff_t *ppos)
@@ -525,3 +527,96 @@ struct dentry *debugfs_create_blob(const char *name, mode_t mode,
525 return debugfs_create_file(name, mode, parent, blob, &fops_blob); 527 return debugfs_create_file(name, mode, parent, blob, &fops_blob);
526} 528}
527EXPORT_SYMBOL_GPL(debugfs_create_blob); 529EXPORT_SYMBOL_GPL(debugfs_create_blob);
530
531#ifdef CONFIG_HAS_IOMEM
532
533/*
534 * The regset32 stuff is used to print 32-bit registers using the
535 * seq_file utilities. We offer printing a register set in an already-opened
536 * sequential file or create a debugfs file that only prints a regset32.
537 */
538
539/**
540 * debugfs_print_regs32 - use seq_print to describe a set of registers
541 * @s: the seq_file structure being used to generate output
542 * @regs: an array if struct debugfs_reg32 structures
543 * @mregs: the length of the above array
544 * @base: the base address to be used in reading the registers
545 * @prefix: a string to be prefixed to every output line
546 *
547 * This function outputs a text block describing the current values of
548 * some 32-bit hardware registers. It is meant to be used within debugfs
549 * files based on seq_file that need to show registers, intermixed with other
550 * information. The prefix argument may be used to specify a leading string,
551 * because some peripherals have several blocks of identical registers,
552 * for example configuration of dma channels
553 */
554int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
555 int nregs, void __iomem *base, char *prefix)
556{
557 int i, ret = 0;
558
559 for (i = 0; i < nregs; i++, regs++) {
560 if (prefix)
561 ret += seq_printf(s, "%s", prefix);
562 ret += seq_printf(s, "%s = 0x%08x\n", regs->name,
563 readl(base + regs->offset));
564 }
565 return ret;
566}
567EXPORT_SYMBOL_GPL(debugfs_print_regs32);
568
569static int debugfs_show_regset32(struct seq_file *s, void *data)
570{
571 struct debugfs_regset32 *regset = s->private;
572
573 debugfs_print_regs32(s, regset->regs, regset->nregs, regset->base, "");
574 return 0;
575}
576
577static int debugfs_open_regset32(struct inode *inode, struct file *file)
578{
579 return single_open(file, debugfs_show_regset32, inode->i_private);
580}
581
582static const struct file_operations fops_regset32 = {
583 .open = debugfs_open_regset32,
584 .read = seq_read,
585 .llseek = seq_lseek,
586 .release = single_release,
587};
588
589/**
590 * debugfs_create_regset32 - create a debugfs file that returns register values
591 * @name: a pointer to a string containing the name of the file to create.
592 * @mode: the permission that the file should have
593 * @parent: a pointer to the parent dentry for this file. This should be a
594 * directory dentry if set. If this parameter is %NULL, then the
595 * file will be created in the root of the debugfs filesystem.
596 * @regset: a pointer to a struct debugfs_regset32, which contains a pointer
597 * to an array of register definitions, the array size and the base
598 * address where the register bank is to be found.
599 *
600 * This function creates a file in debugfs with the given name that reports
601 * the names and values of a set of 32-bit registers. If the @mode variable
602 * is so set it can be read from. Writing is not supported.
603 *
604 * This function will return a pointer to a dentry if it succeeds. This
605 * pointer must be passed to the debugfs_remove() function when the file is
606 * to be removed (no automatic cleanup happens if your module is unloaded,
607 * you are responsible here.) If an error occurs, %NULL will be returned.
608 *
609 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
610 * returned. It is not wise to check for this value, but rather, check for
611 * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
612 * code.
613 */
614struct dentry *debugfs_create_regset32(const char *name, mode_t mode,
615 struct dentry *parent,
616 struct debugfs_regset32 *regset)
617{
618 return debugfs_create_file(name, mode, parent, regset, &fops_regset32);
619}
620EXPORT_SYMBOL_GPL(debugfs_create_regset32);
621
622#endif /* CONFIG_HAS_IOMEM */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 6cb60fd2ea84..fc3da0d70d68 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -14,7 +14,7 @@
14#ifndef _LINUX_CPU_H_ 14#ifndef _LINUX_CPU_H_
15#define _LINUX_CPU_H_ 15#define _LINUX_CPU_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/node.h> 18#include <linux/node.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/cpumask.h> 20#include <linux/cpumask.h>
@@ -22,19 +22,19 @@
22struct cpu { 22struct cpu {
23 int node_id; /* The node which contains the CPU */ 23 int node_id; /* The node which contains the CPU */
24 int hotpluggable; /* creates sysfs control file if hotpluggable */ 24 int hotpluggable; /* creates sysfs control file if hotpluggable */
25 struct sys_device sysdev; 25 struct device dev;
26}; 26};
27 27
28extern int register_cpu(struct cpu *cpu, int num); 28extern int register_cpu(struct cpu *cpu, int num);
29extern struct sys_device *get_cpu_sysdev(unsigned cpu); 29extern struct device *get_cpu_device(unsigned cpu);
30 30
31extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr); 31extern int cpu_add_dev_attr(struct device_attribute *attr);
32extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr); 32extern void cpu_remove_dev_attr(struct device_attribute *attr);
33 33
34extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); 34extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
35extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); 35extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
36 36
37extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); 37extern int sched_create_sysfs_power_savings_entries(struct device *dev);
38 38
39#ifdef CONFIG_HOTPLUG_CPU 39#ifdef CONFIG_HOTPLUG_CPU
40extern void unregister_cpu(struct cpu *cpu); 40extern void unregister_cpu(struct cpu *cpu);
@@ -160,7 +160,7 @@ static inline void cpu_maps_update_done(void)
160} 160}
161 161
162#endif /* CONFIG_SMP */ 162#endif /* CONFIG_SMP */
163extern struct sysdev_class cpu_sysdev_class; 163extern struct bus_type cpu_subsys;
164 164
165#ifdef CONFIG_HOTPLUG_CPU 165#ifdef CONFIG_HOTPLUG_CPU
166/* Stop CPUs going up and down. */ 166/* Stop CPUs going up and down. */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e7d9b20ddc5b..e8c3abc60811 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -16,6 +16,7 @@
16#define _DEBUGFS_H_ 16#define _DEBUGFS_H_
17 17
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/seq_file.h>
19 20
20#include <linux/types.h> 21#include <linux/types.h>
21 22
@@ -26,6 +27,17 @@ struct debugfs_blob_wrapper {
26 unsigned long size; 27 unsigned long size;
27}; 28};
28 29
30struct debugfs_reg32 {
31 char *name;
32 unsigned long offset;
33};
34
35struct debugfs_regset32 {
36 struct debugfs_reg32 *regs;
37 int nregs;
38 void __iomem *base;
39};
40
29extern struct dentry *arch_debugfs_dir; 41extern struct dentry *arch_debugfs_dir;
30 42
31#if defined(CONFIG_DEBUG_FS) 43#if defined(CONFIG_DEBUG_FS)
@@ -74,6 +86,13 @@ struct dentry *debugfs_create_blob(const char *name, mode_t mode,
74 struct dentry *parent, 86 struct dentry *parent,
75 struct debugfs_blob_wrapper *blob); 87 struct debugfs_blob_wrapper *blob);
76 88
89struct dentry *debugfs_create_regset32(const char *name, mode_t mode,
90 struct dentry *parent,
91 struct debugfs_regset32 *regset);
92
93int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
94 int nregs, void __iomem *base, char *prefix);
95
77bool debugfs_initialized(void); 96bool debugfs_initialized(void);
78 97
79#else 98#else
@@ -188,6 +207,13 @@ static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode,
188 return ERR_PTR(-ENODEV); 207 return ERR_PTR(-ENODEV);
189} 208}
190 209
210static inline struct dentry *debugfs_create_regset32(const char *name,
211 mode_t mode, struct dentry *parent,
212 struct debugfs_regset32 *regset)
213{
214 return ERR_PTR(-ENODEV);
215}
216
191static inline bool debugfs_initialized(void) 217static inline bool debugfs_initialized(void)
192{ 218{
193 return false; 219 return false;
diff --git a/include/linux/device.h b/include/linux/device.h
index 3136ede5a1e1..96acef8dd916 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -53,6 +53,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
53 * struct bus_type - The bus type of the device 53 * struct bus_type - The bus type of the device
54 * 54 *
55 * @name: The name of the bus. 55 * @name: The name of the bus.
56 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
57 * @dev_root: Default device to use as the parent.
56 * @bus_attrs: Default attributes of the bus. 58 * @bus_attrs: Default attributes of the bus.
57 * @dev_attrs: Default attributes of the devices on the bus. 59 * @dev_attrs: Default attributes of the devices on the bus.
58 * @drv_attrs: Default attributes of the device drivers on the bus. 60 * @drv_attrs: Default attributes of the device drivers on the bus.
@@ -86,6 +88,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
86 */ 88 */
87struct bus_type { 89struct bus_type {
88 const char *name; 90 const char *name;
91 const char *dev_name;
92 struct device *dev_root;
89 struct bus_attribute *bus_attrs; 93 struct bus_attribute *bus_attrs;
90 struct device_attribute *dev_attrs; 94 struct device_attribute *dev_attrs;
91 struct driver_attribute *drv_attrs; 95 struct driver_attribute *drv_attrs;
@@ -106,12 +110,30 @@ struct bus_type {
106 struct subsys_private *p; 110 struct subsys_private *p;
107}; 111};
108 112
109extern int __must_check bus_register(struct bus_type *bus); 113/* This is a #define to keep the compiler from merging different
114 * instances of the __key variable */
115#define bus_register(subsys) \
116({ \
117 static struct lock_class_key __key; \
118 __bus_register(subsys, &__key); \
119})
120extern int __must_check __bus_register(struct bus_type *bus,
121 struct lock_class_key *key);
110extern void bus_unregister(struct bus_type *bus); 122extern void bus_unregister(struct bus_type *bus);
111 123
112extern int __must_check bus_rescan_devices(struct bus_type *bus); 124extern int __must_check bus_rescan_devices(struct bus_type *bus);
113 125
114/* iterator helpers for buses */ 126/* iterator helpers for buses */
127struct subsys_dev_iter {
128 struct klist_iter ki;
129 const struct device_type *type;
130};
131void subsys_dev_iter_init(struct subsys_dev_iter *iter,
132 struct bus_type *subsys,
133 struct device *start,
134 const struct device_type *type);
135struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
136void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
115 137
116int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, 138int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
117 int (*fn)(struct device *dev, void *data)); 139 int (*fn)(struct device *dev, void *data));
@@ -121,10 +143,10 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start,
121struct device *bus_find_device_by_name(struct bus_type *bus, 143struct device *bus_find_device_by_name(struct bus_type *bus,
122 struct device *start, 144 struct device *start,
123 const char *name); 145 const char *name);
124 146struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
147 struct device *hint);
125int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, 148int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
126 void *data, int (*fn)(struct device_driver *, void *)); 149 void *data, int (*fn)(struct device_driver *, void *));
127
128void bus_sort_breadthfirst(struct bus_type *bus, 150void bus_sort_breadthfirst(struct bus_type *bus,
129 int (*compare)(const struct device *a, 151 int (*compare)(const struct device *a,
130 const struct device *b)); 152 const struct device *b));
@@ -256,6 +278,33 @@ struct device *driver_find_device(struct device_driver *drv,
256 int (*match)(struct device *dev, void *data)); 278 int (*match)(struct device *dev, void *data));
257 279
258/** 280/**
281 * struct subsys_interface - interfaces to device functions
282 * @name name of the device function
283 * @subsystem subsytem of the devices to attach to
284 * @node the list of functions registered at the subsystem
285 * @add device hookup to device function handler
286 * @remove device hookup to device function handler
287 *
288 * Simple interfaces attached to a subsystem. Multiple interfaces can
289 * attach to a subsystem and its devices. Unlike drivers, they do not
290 * exclusively claim or control devices. Interfaces usually represent
291 * a specific functionality of a subsystem/class of devices.
292 */
293struct subsys_interface {
294 const char *name;
295 struct bus_type *subsys;
296 struct list_head node;
297 int (*add_dev)(struct device *dev, struct subsys_interface *sif);
298 int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
299};
300
301int subsys_interface_register(struct subsys_interface *sif);
302void subsys_interface_unregister(struct subsys_interface *sif);
303
304int subsys_system_register(struct bus_type *subsys,
305 const struct attribute_group **groups);
306
307/**
259 * struct class - device classes 308 * struct class - device classes
260 * @name: Name of the class. 309 * @name: Name of the class.
261 * @owner: The module owner. 310 * @owner: The module owner.
@@ -438,11 +487,31 @@ struct device_attribute {
438 const char *buf, size_t count); 487 const char *buf, size_t count);
439}; 488};
440 489
441#define DEVICE_ATTR(_name, _mode, _show, _store) \ 490struct dev_ext_attribute {
442struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 491 struct device_attribute attr;
492 void *var;
493};
494
495ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
496 char *buf);
497ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
498 const char *buf, size_t count);
499ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
500 char *buf);
501ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
502 const char *buf, size_t count);
443 503
444extern int __must_check device_create_file(struct device *device, 504#define DEVICE_ATTR(_name, _mode, _show, _store) \
445 const struct device_attribute *entry); 505 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
506#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
507 struct dev_ext_attribute dev_attr_##_name = \
508 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
509#define DEVICE_INT_ATTR(_name, _mode, _var) \
510 struct dev_ext_attribute dev_attr_##_name = \
511 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
512
513extern int device_create_file(struct device *device,
514 const struct device_attribute *entry);
446extern void device_remove_file(struct device *dev, 515extern void device_remove_file(struct device *dev,
447 const struct device_attribute *attr); 516 const struct device_attribute *attr);
448extern int __must_check device_create_bin_file(struct device *dev, 517extern int __must_check device_create_bin_file(struct device *dev,
@@ -490,6 +559,9 @@ extern int devres_release_group(struct device *dev, void *id);
490extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 559extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
491extern void devm_kfree(struct device *dev, void *p); 560extern void devm_kfree(struct device *dev, void *p);
492 561
562void __iomem *devm_request_and_ioremap(struct device *dev,
563 struct resource *res);
564
493struct device_dma_parameters { 565struct device_dma_parameters {
494 /* 566 /*
495 * a low level driver may set these to teach IOMMU code about 567 * a low level driver may set these to teach IOMMU code about
@@ -600,6 +672,7 @@ struct device {
600 struct device_node *of_node; /* associated device tree node */ 672 struct device_node *of_node; /* associated device tree node */
601 673
602 dev_t devt; /* dev_t, creates the sysfs "dev" */ 674 dev_t devt; /* dev_t, creates the sysfs "dev" */
675 u32 id; /* device instance */
603 676
604 spinlock_t devres_lock; 677 spinlock_t devres_lock;
605 struct list_head devres_head; 678 struct list_head devres_head;
@@ -924,4 +997,25 @@ extern long sysfs_deprecated;
924#define sysfs_deprecated 0 997#define sysfs_deprecated 0
925#endif 998#endif
926 999
1000/**
1001 * module_driver() - Helper macro for drivers that don't do anything
1002 * special in module init/exit. This eliminates a lot of boilerplate.
1003 * Each module may only use this macro once, and calling it replaces
1004 * module_init() and module_exit().
1005 *
1006 * Use this macro to construct bus specific macros for registering
1007 * drivers, and do not use it on its own.
1008 */
1009#define module_driver(__driver, __register, __unregister) \
1010static int __init __driver##_init(void) \
1011{ \
1012 return __register(&(__driver)); \
1013} \
1014module_init(__driver##_init); \
1015static void __exit __driver##_exit(void) \
1016{ \
1017 __unregister(&(__driver)); \
1018} \
1019module_exit(__driver##_exit);
1020
927#endif /* _DEVICE_H_ */ 1021#endif /* _DEVICE_H_ */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 055b248bdd53..1cd3947987e5 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -13,7 +13,7 @@
13#define _LINUX_EDAC_H_ 13#define _LINUX_EDAC_H_
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/sysdev.h> 16#include <linux/device.h>
17 17
18#define EDAC_OPSTATE_INVAL -1 18#define EDAC_OPSTATE_INVAL -1
19#define EDAC_OPSTATE_POLL 0 19#define EDAC_OPSTATE_POLL 0
@@ -23,12 +23,12 @@
23extern int edac_op_state; 23extern int edac_op_state;
24extern int edac_err_assert; 24extern int edac_err_assert;
25extern atomic_t edac_handlers; 25extern atomic_t edac_handlers;
26extern struct sysdev_class edac_class; 26extern struct bus_type edac_subsys;
27 27
28extern int edac_handler_set(void); 28extern int edac_handler_set(void);
29extern void edac_atomic_assert_error(void); 29extern void edac_atomic_assert_error(void);
30extern struct sysdev_class *edac_get_sysfs_class(void); 30extern struct bus_type *edac_get_sysfs_subsys(void);
31extern void edac_put_sysfs_class(void); 31extern void edac_put_sysfs_subsys(void);
32 32
33static inline void opstate_init(void) 33static inline void opstate_init(void)
34{ 34{
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 07d103a06d64..8e25a9167f13 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -482,6 +482,19 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
482{ 482{
483 return adap->nr; 483 return adap->nr;
484} 484}
485
486/**
487 * module_i2c_driver() - Helper macro for registering a I2C driver
488 * @__i2c_driver: i2c_driver struct
489 *
490 * Helper macro for I2C drivers which do not do anything special in module
491 * init/exit. This eliminates a lot of boilerplate. Each module may only
492 * use this macro once, and calling it replaces module_init() and module_exit()
493 */
494#define module_i2c_driver(__i2c_driver) \
495 module_driver(__i2c_driver, i2c_add_driver, \
496 i2c_del_driver)
497
485#endif /* I2C */ 498#endif /* I2C */
486#endif /* __KERNEL__ */ 499#endif /* __KERNEL__ */
487 500
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index ad81e1c51487..fc615a97e2d3 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -191,8 +191,6 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj)
191} 191}
192 192
193extern struct kobject *kset_find_obj(struct kset *, const char *); 193extern struct kobject *kset_find_obj(struct kset *, const char *);
194extern struct kobject *kset_find_obj_hinted(struct kset *, const char *,
195 struct kobject *);
196 194
197/* The global /sys/kernel/ kobject for people to chain off of */ 195/* The global /sys/kernel/ kobject for people to chain off of */
198extern struct kobject *kernel_kobj; 196extern struct kobject *kernel_kobj;
diff --git a/include/linux/kref.h b/include/linux/kref.h
index d4a62ab2ee5e..abc0120b09b7 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -15,16 +15,81 @@
15#ifndef _KREF_H_ 15#ifndef _KREF_H_
16#define _KREF_H_ 16#define _KREF_H_
17 17
18#include <linux/types.h> 18#include <linux/bug.h>
19#include <linux/atomic.h>
19 20
20struct kref { 21struct kref {
21 atomic_t refcount; 22 atomic_t refcount;
22}; 23};
23 24
24void kref_init(struct kref *kref); 25/**
25void kref_get(struct kref *kref); 26 * kref_init - initialize object.
26int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 27 * @kref: object in question.
27int kref_sub(struct kref *kref, unsigned int count, 28 */
28 void (*release) (struct kref *kref)); 29static inline void kref_init(struct kref *kref)
30{
31 atomic_set(&kref->refcount, 1);
32}
33
34/**
35 * kref_get - increment refcount for object.
36 * @kref: object.
37 */
38static inline void kref_get(struct kref *kref)
39{
40 WARN_ON(!atomic_read(&kref->refcount));
41 atomic_inc(&kref->refcount);
42}
29 43
44/**
45 * kref_sub - subtract a number of refcounts for object.
46 * @kref: object.
47 * @count: Number of recounts to subtract.
48 * @release: pointer to the function that will clean up the object when the
49 * last reference to the object is released.
50 * This pointer is required, and it is not acceptable to pass kfree
51 * in as this function. If the caller does pass kfree to this
52 * function, you will be publicly mocked mercilessly by the kref
53 * maintainer, and anyone else who happens to notice it. You have
54 * been warned.
55 *
56 * Subtract @count from the refcount, and if 0, call release().
57 * Return 1 if the object was removed, otherwise return 0. Beware, if this
58 * function returns 0, you still can not count on the kref from remaining in
59 * memory. Only use the return value if you want to see if the kref is now
60 * gone, not present.
61 */
62static inline int kref_sub(struct kref *kref, unsigned int count,
63 void (*release)(struct kref *kref))
64{
65 WARN_ON(release == NULL);
66
67 if (atomic_sub_and_test((int) count, &kref->refcount)) {
68 release(kref);
69 return 1;
70 }
71 return 0;
72}
73
74/**
75 * kref_put - decrement refcount for object.
76 * @kref: object.
77 * @release: pointer to the function that will clean up the object when the
78 * last reference to the object is released.
79 * This pointer is required, and it is not acceptable to pass kfree
80 * in as this function. If the caller does pass kfree to this
81 * function, you will be publicly mocked mercilessly by the kref
82 * maintainer, and anyone else who happens to notice it. You have
83 * been warned.
84 *
85 * Decrement the refcount, and if 0, call release().
86 * Return 1 if the object was removed, otherwise return 0. Beware, if this
87 * function returns 0, you still can not count on the kref from remaining in
88 * memory. Only use the return value if you want to see if the kref is now
89 * gone, not present.
90 */
91static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref))
92{
93 return kref_sub(kref, 1, release);
94}
30#endif /* _KREF_H_ */ 95#endif /* _KREF_H_ */
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 935699b30b7c..1ac7f6e405f9 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -15,7 +15,6 @@
15#ifndef _LINUX_MEMORY_H_ 15#ifndef _LINUX_MEMORY_H_
16#define _LINUX_MEMORY_H_ 16#define _LINUX_MEMORY_H_
17 17
18#include <linux/sysdev.h>
19#include <linux/node.h> 18#include <linux/node.h>
20#include <linux/compiler.h> 19#include <linux/compiler.h>
21#include <linux/mutex.h> 20#include <linux/mutex.h>
@@ -38,7 +37,7 @@ struct memory_block {
38 int phys_device; /* to which fru does this belong? */ 37 int phys_device; /* to which fru does this belong? */
39 void *hw; /* optional pointer to fw/hw data */ 38 void *hw; /* optional pointer to fw/hw data */
40 int (*phys_callback)(struct memory_block *); 39 int (*phys_callback)(struct memory_block *);
41 struct sys_device sysdev; 40 struct device dev;
42}; 41};
43 42
44int arch_get_memory_phys_device(unsigned long start_pfn); 43int arch_get_memory_phys_device(unsigned long start_pfn);
diff --git a/include/linux/node.h b/include/linux/node.h
index 92370e22343c..624e53cecc02 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -14,12 +14,12 @@
14#ifndef _LINUX_NODE_H_ 14#ifndef _LINUX_NODE_H_
15#define _LINUX_NODE_H_ 15#define _LINUX_NODE_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/cpumask.h> 18#include <linux/cpumask.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20 20
21struct node { 21struct node {
22 struct sys_device sysdev; 22 struct device dev;
23 23
24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) 24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
25 struct work_struct node_work; 25 struct work_struct node_work;
@@ -80,6 +80,6 @@ static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
80} 80}
81#endif 81#endif
82 82
83#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 83#define to_node(device) container_of(device, struct node, dev)
84 84
85#endif /* _LINUX_NODE_H_ */ 85#endif /* _LINUX_NODE_H_ */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 2a23f7d1a825..5622fa24e97b 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -63,7 +63,7 @@ struct platform_device_info {
63 u64 dma_mask; 63 u64 dma_mask;
64}; 64};
65extern struct platform_device *platform_device_register_full( 65extern struct platform_device *platform_device_register_full(
66 struct platform_device_info *pdevinfo); 66 const struct platform_device_info *pdevinfo);
67 67
68/** 68/**
69 * platform_device_register_resndata - add a platform-level device with 69 * platform_device_register_resndata - add a platform-level device with
@@ -196,16 +196,8 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
196 * calling it replaces module_init() and module_exit() 196 * calling it replaces module_init() and module_exit()
197 */ 197 */
198#define module_platform_driver(__platform_driver) \ 198#define module_platform_driver(__platform_driver) \
199static int __init __platform_driver##_init(void) \ 199 module_driver(__platform_driver, platform_driver_register, \
200{ \ 200 platform_driver_unregister)
201 return platform_driver_register(&(__platform_driver)); \
202} \
203module_init(__platform_driver##_init); \
204static void __exit __platform_driver##_exit(void) \
205{ \
206 platform_driver_unregister(&(__platform_driver)); \
207} \
208module_exit(__platform_driver##_exit);
209 201
210extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 202extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
211 int (*probe)(struct platform_device *), 203 int (*probe)(struct platform_device *),
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index bb4f5fbbbd8e..176fce9cc6b1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -200,6 +200,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
200 driver_unregister(&sdrv->driver); 200 driver_unregister(&sdrv->driver);
201} 201}
202 202
203/**
204 * module_spi_driver() - Helper macro for registering a SPI driver
205 * @__spi_driver: spi_driver struct
206 *
207 * Helper macro for SPI drivers which do not do anything special in module
208 * init/exit. This eliminates a lot of boilerplate. Each module may only
209 * use this macro once, and calling it replaces module_init() and module_exit()
210 */
211#define module_spi_driver(__spi_driver) \
212 module_driver(__spi_driver, spi_register_driver, \
213 spi_unregister_driver)
203 214
204/** 215/**
205 * struct spi_master - interface to SPI master controller 216 * struct spi_master - interface to SPI master controller
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d3d0c1374334..5d258c3180ae 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -953,6 +953,18 @@ extern int usb_register_driver(struct usb_driver *, struct module *,
953 953
954extern void usb_deregister(struct usb_driver *); 954extern void usb_deregister(struct usb_driver *);
955 955
956/**
957 * module_usb_driver() - Helper macro for registering a USB driver
958 * @__usb_driver: usb_driver struct
959 *
960 * Helper macro for USB drivers which do not do anything special in module
961 * init/exit. This eliminates a lot of boilerplate. Each module may only
962 * use this macro once, and calling it replaces module_init() and module_exit()
963 */
964#define module_usb_driver(__usb_driver) \
965 module_driver(__usb_driver, usb_register, \
966 usb_deregister)
967
956extern int usb_register_device_driver(struct usb_device_driver *, 968extern int usb_register_device_driver(struct usb_device_driver *,
957 struct module *); 969 struct module *);
958extern void usb_deregister_device_driver(struct usb_device_driver *); 970extern void usb_deregister_device_driver(struct usb_device_driver *);
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
index d29c153705bc..cc2e1a7e44ec 100644
--- a/include/xen/balloon.h
+++ b/include/xen/balloon.h
@@ -29,11 +29,11 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages,
29 bool highmem); 29 bool highmem);
30void free_xenballooned_pages(int nr_pages, struct page **pages); 30void free_xenballooned_pages(int nr_pages, struct page **pages);
31 31
32struct sys_device; 32struct device;
33#ifdef CONFIG_XEN_SELFBALLOONING 33#ifdef CONFIG_XEN_SELFBALLOONING
34extern int register_xen_selfballooning(struct sys_device *sysdev); 34extern int register_xen_selfballooning(struct device *dev);
35#else 35#else
36static inline int register_xen_selfballooning(struct sys_device *sysdev) 36static inline int register_xen_selfballooning(struct device *dev)
37{ 37{
38 return -ENOSYS; 38 return -ENOSYS;
39} 39}
diff --git a/kernel/rtmutex-tester.c b/kernel/rtmutex-tester.c
index 3d9f31cd79e7..98ec49475460 100644
--- a/kernel/rtmutex-tester.c
+++ b/kernel/rtmutex-tester.c
@@ -6,11 +6,11 @@
6 * Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com> 6 * Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com>
7 * 7 *
8 */ 8 */
9#include <linux/device.h>
9#include <linux/kthread.h> 10#include <linux/kthread.h>
10#include <linux/export.h> 11#include <linux/export.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <linux/spinlock.h> 13#include <linux/spinlock.h>
13#include <linux/sysdev.h>
14#include <linux/timer.h> 14#include <linux/timer.h>
15#include <linux/freezer.h> 15#include <linux/freezer.h>
16 16
@@ -27,7 +27,7 @@ struct test_thread_data {
27 int opdata; 27 int opdata;
28 int mutexes[MAX_RT_TEST_MUTEXES]; 28 int mutexes[MAX_RT_TEST_MUTEXES];
29 int event; 29 int event;
30 struct sys_device sysdev; 30 struct device dev;
31}; 31};
32 32
33static struct test_thread_data thread_data[MAX_RT_TEST_THREADS]; 33static struct test_thread_data thread_data[MAX_RT_TEST_THREADS];
@@ -271,7 +271,7 @@ static int test_func(void *data)
271 * 271 *
272 * opcode:data 272 * opcode:data
273 */ 273 */
274static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribute *attr, 274static ssize_t sysfs_test_command(struct device *dev, struct device_attribute *attr,
275 const char *buf, size_t count) 275 const char *buf, size_t count)
276{ 276{
277 struct sched_param schedpar; 277 struct sched_param schedpar;
@@ -279,8 +279,8 @@ static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribut
279 char cmdbuf[32]; 279 char cmdbuf[32];
280 int op, dat, tid, ret; 280 int op, dat, tid, ret;
281 281
282 td = container_of(dev, struct test_thread_data, sysdev); 282 td = container_of(dev, struct test_thread_data, dev);
283 tid = td->sysdev.id; 283 tid = td->dev.id;
284 284
285 /* strings from sysfs write are not 0 terminated! */ 285 /* strings from sysfs write are not 0 terminated! */
286 if (count >= sizeof(cmdbuf)) 286 if (count >= sizeof(cmdbuf))
@@ -334,7 +334,7 @@ static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribut
334 * @dev: thread to query 334 * @dev: thread to query
335 * @buf: char buffer to be filled with thread status info 335 * @buf: char buffer to be filled with thread status info
336 */ 336 */
337static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute *attr, 337static ssize_t sysfs_test_status(struct device *dev, struct device_attribute *attr,
338 char *buf) 338 char *buf)
339{ 339{
340 struct test_thread_data *td; 340 struct test_thread_data *td;
@@ -342,8 +342,8 @@ static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute
342 char *curr = buf; 342 char *curr = buf;
343 int i; 343 int i;
344 344
345 td = container_of(dev, struct test_thread_data, sysdev); 345 td = container_of(dev, struct test_thread_data, dev);
346 tsk = threads[td->sysdev.id]; 346 tsk = threads[td->dev.id];
347 347
348 spin_lock(&rttest_lock); 348 spin_lock(&rttest_lock);
349 349
@@ -360,28 +360,29 @@ static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute
360 spin_unlock(&rttest_lock); 360 spin_unlock(&rttest_lock);
361 361
362 curr += sprintf(curr, ", T: %p, R: %p\n", tsk, 362 curr += sprintf(curr, ", T: %p, R: %p\n", tsk,
363 mutexes[td->sysdev.id].owner); 363 mutexes[td->dev.id].owner);
364 364
365 return curr - buf; 365 return curr - buf;
366} 366}
367 367
368static SYSDEV_ATTR(status, 0600, sysfs_test_status, NULL); 368static DEVICE_ATTR(status, 0600, sysfs_test_status, NULL);
369static SYSDEV_ATTR(command, 0600, NULL, sysfs_test_command); 369static DEVICE_ATTR(command, 0600, NULL, sysfs_test_command);
370 370
371static struct sysdev_class rttest_sysclass = { 371static struct bus_type rttest_subsys = {
372 .name = "rttest", 372 .name = "rttest",
373 .dev_name = "rttest",
373}; 374};
374 375
375static int init_test_thread(int id) 376static int init_test_thread(int id)
376{ 377{
377 thread_data[id].sysdev.cls = &rttest_sysclass; 378 thread_data[id].dev.bus = &rttest_subsys;
378 thread_data[id].sysdev.id = id; 379 thread_data[id].dev.id = id;
379 380
380 threads[id] = kthread_run(test_func, &thread_data[id], "rt-test-%d", id); 381 threads[id] = kthread_run(test_func, &thread_data[id], "rt-test-%d", id);
381 if (IS_ERR(threads[id])) 382 if (IS_ERR(threads[id]))
382 return PTR_ERR(threads[id]); 383 return PTR_ERR(threads[id]);
383 384
384 return sysdev_register(&thread_data[id].sysdev); 385 return device_register(&thread_data[id].dev);
385} 386}
386 387
387static int init_rttest(void) 388static int init_rttest(void)
@@ -393,7 +394,7 @@ static int init_rttest(void)
393 for (i = 0; i < MAX_RT_TEST_MUTEXES; i++) 394 for (i = 0; i < MAX_RT_TEST_MUTEXES; i++)
394 rt_mutex_init(&mutexes[i]); 395 rt_mutex_init(&mutexes[i]);
395 396
396 ret = sysdev_class_register(&rttest_sysclass); 397 ret = subsys_system_register(&rttest_subsys, NULL);
397 if (ret) 398 if (ret)
398 return ret; 399 return ret;
399 400
@@ -401,10 +402,10 @@ static int init_rttest(void)
401 ret = init_test_thread(i); 402 ret = init_test_thread(i);
402 if (ret) 403 if (ret)
403 break; 404 break;
404 ret = sysdev_create_file(&thread_data[i].sysdev, &attr_status); 405 ret = device_create_file(&thread_data[i].dev, &dev_attr_status);
405 if (ret) 406 if (ret)
406 break; 407 break;
407 ret = sysdev_create_file(&thread_data[i].sysdev, &attr_command); 408 ret = device_create_file(&thread_data[i].dev, &dev_attr_command);
408 if (ret) 409 if (ret)
409 break; 410 break;
410 } 411 }
diff --git a/kernel/sched.c b/kernel/sched.c
index d6b149ccf925..a7f381a78469 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7940,54 +7940,52 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
7940} 7940}
7941 7941
7942#ifdef CONFIG_SCHED_MC 7942#ifdef CONFIG_SCHED_MC
7943static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, 7943static ssize_t sched_mc_power_savings_show(struct device *dev,
7944 struct sysdev_class_attribute *attr, 7944 struct device_attribute *attr,
7945 char *page) 7945 char *buf)
7946{ 7946{
7947 return sprintf(page, "%u\n", sched_mc_power_savings); 7947 return sprintf(buf, "%u\n", sched_mc_power_savings);
7948} 7948}
7949static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, 7949static ssize_t sched_mc_power_savings_store(struct device *dev,
7950 struct sysdev_class_attribute *attr, 7950 struct device_attribute *attr,
7951 const char *buf, size_t count) 7951 const char *buf, size_t count)
7952{ 7952{
7953 return sched_power_savings_store(buf, count, 0); 7953 return sched_power_savings_store(buf, count, 0);
7954} 7954}
7955static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644, 7955static DEVICE_ATTR(sched_mc_power_savings, 0644,
7956 sched_mc_power_savings_show, 7956 sched_mc_power_savings_show,
7957 sched_mc_power_savings_store); 7957 sched_mc_power_savings_store);
7958#endif 7958#endif
7959 7959
7960#ifdef CONFIG_SCHED_SMT 7960#ifdef CONFIG_SCHED_SMT
7961static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, 7961static ssize_t sched_smt_power_savings_show(struct device *dev,
7962 struct sysdev_class_attribute *attr, 7962 struct device_attribute *attr,
7963 char *page) 7963 char *buf)
7964{ 7964{
7965 return sprintf(page, "%u\n", sched_smt_power_savings); 7965 return sprintf(buf, "%u\n", sched_smt_power_savings);
7966} 7966}
7967static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, 7967static ssize_t sched_smt_power_savings_store(struct device *dev,
7968 struct sysdev_class_attribute *attr, 7968 struct device_attribute *attr,
7969 const char *buf, size_t count) 7969 const char *buf, size_t count)
7970{ 7970{
7971 return sched_power_savings_store(buf, count, 1); 7971 return sched_power_savings_store(buf, count, 1);
7972} 7972}
7973static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644, 7973static DEVICE_ATTR(sched_smt_power_savings, 0644,
7974 sched_smt_power_savings_show, 7974 sched_smt_power_savings_show,
7975 sched_smt_power_savings_store); 7975 sched_smt_power_savings_store);
7976#endif 7976#endif
7977 7977
7978int __init sched_create_sysfs_power_savings_entries(struct sysdev_class *cls) 7978int __init sched_create_sysfs_power_savings_entries(struct device *dev)
7979{ 7979{
7980 int err = 0; 7980 int err = 0;
7981 7981
7982#ifdef CONFIG_SCHED_SMT 7982#ifdef CONFIG_SCHED_SMT
7983 if (smt_capable()) 7983 if (smt_capable())
7984 err = sysfs_create_file(&cls->kset.kobj, 7984 err = device_create_file(dev, &dev_attr_sched_smt_power_savings);
7985 &attr_sched_smt_power_savings.attr);
7986#endif 7985#endif
7987#ifdef CONFIG_SCHED_MC 7986#ifdef CONFIG_SCHED_MC
7988 if (!err && mc_capable()) 7987 if (!err && mc_capable())
7989 err = sysfs_create_file(&cls->kset.kobj, 7988 err = device_create_file(dev, &dev_attr_sched_mc_power_savings);
7990 &attr_sched_mc_power_savings.attr);
7991#endif 7989#endif
7992 return err; 7990 return err;
7993} 7991}
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 1ecd6ba36d6c..9cd928f7a7c6 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -17,7 +17,6 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/notifier.h> 18#include <linux/notifier.h>
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/sysdev.h>
21 20
22#include "tick-internal.h" 21#include "tick-internal.h"
23 22
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index d3ad022136e5..a45ca167ab24 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -23,8 +23,8 @@
23 * o Allow clocksource drivers to be unregistered 23 * o Allow clocksource drivers to be unregistered
24 */ 24 */
25 25
26#include <linux/device.h>
26#include <linux/clocksource.h> 27#include <linux/clocksource.h>
27#include <linux/sysdev.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */ 30#include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */
@@ -796,8 +796,8 @@ EXPORT_SYMBOL(clocksource_unregister);
796 * Provides sysfs interface for listing current clocksource. 796 * Provides sysfs interface for listing current clocksource.
797 */ 797 */
798static ssize_t 798static ssize_t
799sysfs_show_current_clocksources(struct sys_device *dev, 799sysfs_show_current_clocksources(struct device *dev,
800 struct sysdev_attribute *attr, char *buf) 800 struct device_attribute *attr, char *buf)
801{ 801{
802 ssize_t count = 0; 802 ssize_t count = 0;
803 803
@@ -818,8 +818,8 @@ sysfs_show_current_clocksources(struct sys_device *dev,
818 * Takes input from sysfs interface for manually overriding the default 818 * Takes input from sysfs interface for manually overriding the default
819 * clocksource selection. 819 * clocksource selection.
820 */ 820 */
821static ssize_t sysfs_override_clocksource(struct sys_device *dev, 821static ssize_t sysfs_override_clocksource(struct device *dev,
822 struct sysdev_attribute *attr, 822 struct device_attribute *attr,
823 const char *buf, size_t count) 823 const char *buf, size_t count)
824{ 824{
825 size_t ret = count; 825 size_t ret = count;
@@ -853,8 +853,8 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
853 * Provides sysfs interface for listing registered clocksources 853 * Provides sysfs interface for listing registered clocksources
854 */ 854 */
855static ssize_t 855static ssize_t
856sysfs_show_available_clocksources(struct sys_device *dev, 856sysfs_show_available_clocksources(struct device *dev,
857 struct sysdev_attribute *attr, 857 struct device_attribute *attr,
858 char *buf) 858 char *buf)
859{ 859{
860 struct clocksource *src; 860 struct clocksource *src;
@@ -883,35 +883,36 @@ sysfs_show_available_clocksources(struct sys_device *dev,
883/* 883/*
884 * Sysfs setup bits: 884 * Sysfs setup bits:
885 */ 885 */
886static SYSDEV_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources, 886static DEVICE_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources,
887 sysfs_override_clocksource); 887 sysfs_override_clocksource);
888 888
889static SYSDEV_ATTR(available_clocksource, 0444, 889static DEVICE_ATTR(available_clocksource, 0444,
890 sysfs_show_available_clocksources, NULL); 890 sysfs_show_available_clocksources, NULL);
891 891
892static struct sysdev_class clocksource_sysclass = { 892static struct bus_type clocksource_subsys = {
893 .name = "clocksource", 893 .name = "clocksource",
894 .dev_name = "clocksource",
894}; 895};
895 896
896static struct sys_device device_clocksource = { 897static struct device device_clocksource = {
897 .id = 0, 898 .id = 0,
898 .cls = &clocksource_sysclass, 899 .bus = &clocksource_subsys,
899}; 900};
900 901
901static int __init init_clocksource_sysfs(void) 902static int __init init_clocksource_sysfs(void)
902{ 903{
903 int error = sysdev_class_register(&clocksource_sysclass); 904 int error = subsys_system_register(&clocksource_subsys, NULL);
904 905
905 if (!error) 906 if (!error)
906 error = sysdev_register(&device_clocksource); 907 error = device_register(&device_clocksource);
907 if (!error) 908 if (!error)
908 error = sysdev_create_file( 909 error = device_create_file(
909 &device_clocksource, 910 &device_clocksource,
910 &attr_current_clocksource); 911 &dev_attr_current_clocksource);
911 if (!error) 912 if (!error)
912 error = sysdev_create_file( 913 error = device_create_file(
913 &device_clocksource, 914 &device_clocksource,
914 &attr_available_clocksource); 915 &dev_attr_available_clocksource);
915 return error; 916 return error;
916} 917}
917 918
diff --git a/lib/Makefile b/lib/Makefile
index a4da283f5dc0..6f195ff6a1a1 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -17,7 +17,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
17lib-$(CONFIG_MMU) += ioremap.o 17lib-$(CONFIG_MMU) += ioremap.o
18lib-$(CONFIG_SMP) += cpumask.o 18lib-$(CONFIG_SMP) += cpumask.o
19 19
20lib-y += kobject.o kref.o klist.o 20lib-y += kobject.o klist.o
21 21
22obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ 22obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
23 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ 23 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
diff --git a/lib/devres.c b/lib/devres.c
index 7c0e953a7486..4fbc09e6e9e6 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -85,6 +85,57 @@ void devm_iounmap(struct device *dev, void __iomem *addr)
85} 85}
86EXPORT_SYMBOL(devm_iounmap); 86EXPORT_SYMBOL(devm_iounmap);
87 87
88/**
89 * devm_request_and_ioremap() - Check, request region, and ioremap resource
90 * @dev: Generic device to handle the resource for
91 * @res: resource to be handled
92 *
93 * Takes all necessary steps to ioremap a mem resource. Uses managed device, so
94 * everything is undone on driver detach. Checks arguments, so you can feed
95 * it the result from e.g. platform_get_resource() directly. Returns the
96 * remapped pointer or NULL on error. Usage example:
97 *
98 * res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
99 * base = devm_request_and_ioremap(&pdev->dev, res);
100 * if (!base)
101 * return -EADDRNOTAVAIL;
102 */
103void __iomem *devm_request_and_ioremap(struct device *dev,
104 struct resource *res)
105{
106 resource_size_t size;
107 const char *name;
108 void __iomem *dest_ptr;
109
110 BUG_ON(!dev);
111
112 if (!res || resource_type(res) != IORESOURCE_MEM) {
113 dev_err(dev, "invalid resource\n");
114 return NULL;
115 }
116
117 size = resource_size(res);
118 name = res->name ?: dev_name(dev);
119
120 if (!devm_request_mem_region(dev, res->start, size, name)) {
121 dev_err(dev, "can't request region for resource %pR\n", res);
122 return NULL;
123 }
124
125 if (res->flags & IORESOURCE_CACHEABLE)
126 dest_ptr = devm_ioremap(dev, res->start, size);
127 else
128 dest_ptr = devm_ioremap_nocache(dev, res->start, size);
129
130 if (!dest_ptr) {
131 dev_err(dev, "ioremap failed for resource %pR\n", res);
132 devm_release_mem_region(dev, res->start, size);
133 }
134
135 return dest_ptr;
136}
137EXPORT_SYMBOL(devm_request_and_ioremap);
138
88#ifdef CONFIG_HAS_IOPORT 139#ifdef CONFIG_HAS_IOPORT
89/* 140/*
90 * Generic iomap devres 141 * Generic iomap devres
@@ -348,5 +399,5 @@ void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask)
348 } 399 }
349} 400}
350EXPORT_SYMBOL(pcim_iounmap_regions); 401EXPORT_SYMBOL(pcim_iounmap_regions);
351#endif 402#endif /* CONFIG_PCI */
352#endif 403#endif /* CONFIG_HAS_IOPORT */
diff --git a/lib/kobject.c b/lib/kobject.c
index 640bd98a4c8a..c33d7a18d635 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -746,43 +746,11 @@ void kset_unregister(struct kset *k)
746 */ 746 */
747struct kobject *kset_find_obj(struct kset *kset, const char *name) 747struct kobject *kset_find_obj(struct kset *kset, const char *name)
748{ 748{
749 return kset_find_obj_hinted(kset, name, NULL);
750}
751
752/**
753 * kset_find_obj_hinted - search for object in kset given a predecessor hint.
754 * @kset: kset we're looking in.
755 * @name: object's name.
756 * @hint: hint to possible object's predecessor.
757 *
758 * Check the hint's next object and if it is a match return it directly,
759 * otherwise, fall back to the behavior of kset_find_obj(). Either way
760 * a reference for the returned object is held and the reference on the
761 * hinted object is released.
762 */
763struct kobject *kset_find_obj_hinted(struct kset *kset, const char *name,
764 struct kobject *hint)
765{
766 struct kobject *k; 749 struct kobject *k;
767 struct kobject *ret = NULL; 750 struct kobject *ret = NULL;
768 751
769 spin_lock(&kset->list_lock); 752 spin_lock(&kset->list_lock);
770 753
771 if (!hint)
772 goto slow_search;
773
774 /* end of list detection */
775 if (hint->entry.next == kset->list.next)
776 goto slow_search;
777
778 k = container_of(hint->entry.next, struct kobject, entry);
779 if (!kobject_name(k) || strcmp(kobject_name(k), name))
780 goto slow_search;
781
782 ret = kobject_get(k);
783 goto unlock_exit;
784
785slow_search:
786 list_for_each_entry(k, &kset->list, entry) { 754 list_for_each_entry(k, &kset->list, entry) {
787 if (kobject_name(k) && !strcmp(kobject_name(k), name)) { 755 if (kobject_name(k) && !strcmp(kobject_name(k), name)) {
788 ret = kobject_get(k); 756 ret = kobject_get(k);
@@ -790,12 +758,7 @@ slow_search:
790 } 758 }
791 } 759 }
792 760
793unlock_exit:
794 spin_unlock(&kset->list_lock); 761 spin_unlock(&kset->list_lock);
795
796 if (hint)
797 kobject_put(hint);
798
799 return ret; 762 return ret;
800} 763}
801 764
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index ad72a03ce5e9..e66e9b632617 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -259,6 +259,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
259 struct sk_buff *skb; 259 struct sk_buff *skb;
260 size_t len; 260 size_t len;
261 261
262 if (!netlink_has_listeners(uevent_sock, 1))
263 continue;
264
262 /* allocate message with the maximum possible size */ 265 /* allocate message with the maximum possible size */
263 len = strlen(action_string) + strlen(devpath) + 2; 266 len = strlen(action_string) + strlen(devpath) + 2;
264 skb = alloc_skb(len + env->buflen, GFP_KERNEL); 267 skb = alloc_skb(len + env->buflen, GFP_KERNEL);
diff --git a/lib/kref.c b/lib/kref.c
deleted file mode 100644
index 3efb882b11db..000000000000
--- a/lib/kref.c
+++ /dev/null
@@ -1,97 +0,0 @@
1/*
2 * kref.c - library routines for handling generic reference counted objects
3 *
4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 2004 IBM Corp.
6 *
7 * based on lib/kobject.c which was:
8 * Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org>
9 *
10 * This file is released under the GPLv2.
11 *
12 */
13
14#include <linux/kref.h>
15#include <linux/module.h>
16#include <linux/slab.h>
17
18/**
19 * kref_init - initialize object.
20 * @kref: object in question.
21 */
22void kref_init(struct kref *kref)
23{
24 atomic_set(&kref->refcount, 1);
25 smp_mb();
26}
27
28/**
29 * kref_get - increment refcount for object.
30 * @kref: object.
31 */
32void kref_get(struct kref *kref)
33{
34 WARN_ON(!atomic_read(&kref->refcount));
35 atomic_inc(&kref->refcount);
36 smp_mb__after_atomic_inc();
37}
38
39/**
40 * kref_put - decrement refcount for object.
41 * @kref: object.
42 * @release: pointer to the function that will clean up the object when the
43 * last reference to the object is released.
44 * This pointer is required, and it is not acceptable to pass kfree
45 * in as this function.
46 *
47 * Decrement the refcount, and if 0, call release().
48 * Return 1 if the object was removed, otherwise return 0. Beware, if this
49 * function returns 0, you still can not count on the kref from remaining in
50 * memory. Only use the return value if you want to see if the kref is now
51 * gone, not present.
52 */
53int kref_put(struct kref *kref, void (*release)(struct kref *kref))
54{
55 WARN_ON(release == NULL);
56 WARN_ON(release == (void (*)(struct kref *))kfree);
57
58 if (atomic_dec_and_test(&kref->refcount)) {
59 release(kref);
60 return 1;
61 }
62 return 0;
63}
64
65
66/**
67 * kref_sub - subtract a number of refcounts for object.
68 * @kref: object.
69 * @count: Number of recounts to subtract.
70 * @release: pointer to the function that will clean up the object when the
71 * last reference to the object is released.
72 * This pointer is required, and it is not acceptable to pass kfree
73 * in as this function.
74 *
75 * Subtract @count from the refcount, and if 0, call release().
76 * Return 1 if the object was removed, otherwise return 0. Beware, if this
77 * function returns 0, you still can not count on the kref from remaining in
78 * memory. Only use the return value if you want to see if the kref is now
79 * gone, not present.
80 */
81int kref_sub(struct kref *kref, unsigned int count,
82 void (*release)(struct kref *kref))
83{
84 WARN_ON(release == NULL);
85 WARN_ON(release == (void (*)(struct kref *))kfree);
86
87 if (atomic_sub_and_test((int) count, &kref->refcount)) {
88 release(kref);
89 return 1;
90 }
91 return 0;
92}
93
94EXPORT_SYMBOL(kref_init);
95EXPORT_SYMBOL(kref_get);
96EXPORT_SYMBOL(kref_put);
97EXPORT_SYMBOL(kref_sub);
diff --git a/mm/compaction.c b/mm/compaction.c
index 899d95638586..1253d7ac332b 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -721,23 +721,23 @@ int sysctl_extfrag_handler(struct ctl_table *table, int write,
721} 721}
722 722
723#if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA) 723#if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
724ssize_t sysfs_compact_node(struct sys_device *dev, 724ssize_t sysfs_compact_node(struct device *dev,
725 struct sysdev_attribute *attr, 725 struct device_attribute *attr,
726 const char *buf, size_t count) 726 const char *buf, size_t count)
727{ 727{
728 compact_node(dev->id); 728 compact_node(dev->id);
729 729
730 return count; 730 return count;
731} 731}
732static SYSDEV_ATTR(compact, S_IWUSR, NULL, sysfs_compact_node); 732static DEVICE_ATTR(compact, S_IWUSR, NULL, sysfs_compact_node);
733 733
734int compaction_register_node(struct node *node) 734int compaction_register_node(struct node *node)
735{ 735{
736 return sysdev_create_file(&node->sysdev, &attr_compact); 736 return device_create_file(&node->dev, &dev_attr_compact);
737} 737}
738 738
739void compaction_unregister_node(struct node *node) 739void compaction_unregister_node(struct node *node)
740{ 740{
741 return sysdev_remove_file(&node->sysdev, &attr_compact); 741 return device_remove_file(&node->dev, &dev_attr_compact);
742} 742}
743#endif /* CONFIG_SYSFS && CONFIG_NUMA */ 743#endif /* CONFIG_SYSFS && CONFIG_NUMA */
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2316840b337a..7acd12503f73 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1592,9 +1592,9 @@ static void __init hugetlb_sysfs_init(void)
1592 1592
1593/* 1593/*
1594 * node_hstate/s - associate per node hstate attributes, via their kobjects, 1594 * node_hstate/s - associate per node hstate attributes, via their kobjects,
1595 * with node sysdevs in node_devices[] using a parallel array. The array 1595 * with node devices in node_devices[] using a parallel array. The array
1596 * index of a node sysdev or _hstate == node id. 1596 * index of a node device or _hstate == node id.
1597 * This is here to avoid any static dependency of the node sysdev driver, in 1597 * This is here to avoid any static dependency of the node device driver, in
1598 * the base kernel, on the hugetlb module. 1598 * the base kernel, on the hugetlb module.
1599 */ 1599 */
1600struct node_hstate { 1600struct node_hstate {
@@ -1604,7 +1604,7 @@ struct node_hstate {
1604struct node_hstate node_hstates[MAX_NUMNODES]; 1604struct node_hstate node_hstates[MAX_NUMNODES];
1605 1605
1606/* 1606/*
1607 * A subset of global hstate attributes for node sysdevs 1607 * A subset of global hstate attributes for node devices
1608 */ 1608 */
1609static struct attribute *per_node_hstate_attrs[] = { 1609static struct attribute *per_node_hstate_attrs[] = {
1610 &nr_hugepages_attr.attr, 1610 &nr_hugepages_attr.attr,
@@ -1618,7 +1618,7 @@ static struct attribute_group per_node_hstate_attr_group = {
1618}; 1618};
1619 1619
1620/* 1620/*
1621 * kobj_to_node_hstate - lookup global hstate for node sysdev hstate attr kobj. 1621 * kobj_to_node_hstate - lookup global hstate for node device hstate attr kobj.
1622 * Returns node id via non-NULL nidp. 1622 * Returns node id via non-NULL nidp.
1623 */ 1623 */
1624static struct hstate *kobj_to_node_hstate(struct kobject *kobj, int *nidp) 1624static struct hstate *kobj_to_node_hstate(struct kobject *kobj, int *nidp)
@@ -1641,13 +1641,13 @@ static struct hstate *kobj_to_node_hstate(struct kobject *kobj, int *nidp)
1641} 1641}
1642 1642
1643/* 1643/*
1644 * Unregister hstate attributes from a single node sysdev. 1644 * Unregister hstate attributes from a single node device.
1645 * No-op if no hstate attributes attached. 1645 * No-op if no hstate attributes attached.
1646 */ 1646 */
1647void hugetlb_unregister_node(struct node *node) 1647void hugetlb_unregister_node(struct node *node)
1648{ 1648{
1649 struct hstate *h; 1649 struct hstate *h;
1650 struct node_hstate *nhs = &node_hstates[node->sysdev.id]; 1650 struct node_hstate *nhs = &node_hstates[node->dev.id];
1651 1651
1652 if (!nhs->hugepages_kobj) 1652 if (!nhs->hugepages_kobj)
1653 return; /* no hstate attributes */ 1653 return; /* no hstate attributes */
@@ -1663,7 +1663,7 @@ void hugetlb_unregister_node(struct node *node)
1663} 1663}
1664 1664
1665/* 1665/*
1666 * hugetlb module exit: unregister hstate attributes from node sysdevs 1666 * hugetlb module exit: unregister hstate attributes from node devices
1667 * that have them. 1667 * that have them.
1668 */ 1668 */
1669static void hugetlb_unregister_all_nodes(void) 1669static void hugetlb_unregister_all_nodes(void)
@@ -1671,7 +1671,7 @@ static void hugetlb_unregister_all_nodes(void)
1671 int nid; 1671 int nid;
1672 1672
1673 /* 1673 /*
1674 * disable node sysdev registrations. 1674 * disable node device registrations.
1675 */ 1675 */
1676 register_hugetlbfs_with_node(NULL, NULL); 1676 register_hugetlbfs_with_node(NULL, NULL);
1677 1677
@@ -1683,20 +1683,20 @@ static void hugetlb_unregister_all_nodes(void)
1683} 1683}
1684 1684
1685/* 1685/*
1686 * Register hstate attributes for a single node sysdev. 1686 * Register hstate attributes for a single node device.
1687 * No-op if attributes already registered. 1687 * No-op if attributes already registered.
1688 */ 1688 */
1689void hugetlb_register_node(struct node *node) 1689void hugetlb_register_node(struct node *node)
1690{ 1690{
1691 struct hstate *h; 1691 struct hstate *h;
1692 struct node_hstate *nhs = &node_hstates[node->sysdev.id]; 1692 struct node_hstate *nhs = &node_hstates[node->dev.id];
1693 int err; 1693 int err;
1694 1694
1695 if (nhs->hugepages_kobj) 1695 if (nhs->hugepages_kobj)
1696 return; /* already allocated */ 1696 return; /* already allocated */
1697 1697
1698 nhs->hugepages_kobj = kobject_create_and_add("hugepages", 1698 nhs->hugepages_kobj = kobject_create_and_add("hugepages",
1699 &node->sysdev.kobj); 1699 &node->dev.kobj);
1700 if (!nhs->hugepages_kobj) 1700 if (!nhs->hugepages_kobj)
1701 return; 1701 return;
1702 1702
@@ -1707,7 +1707,7 @@ void hugetlb_register_node(struct node *node)
1707 if (err) { 1707 if (err) {
1708 printk(KERN_ERR "Hugetlb: Unable to add hstate %s" 1708 printk(KERN_ERR "Hugetlb: Unable to add hstate %s"
1709 " for node %d\n", 1709 " for node %d\n",
1710 h->name, node->sysdev.id); 1710 h->name, node->dev.id);
1711 hugetlb_unregister_node(node); 1711 hugetlb_unregister_node(node);
1712 break; 1712 break;
1713 } 1713 }
@@ -1716,8 +1716,8 @@ void hugetlb_register_node(struct node *node)
1716 1716
1717/* 1717/*
1718 * hugetlb init time: register hstate attributes for all registered node 1718 * hugetlb init time: register hstate attributes for all registered node
1719 * sysdevs of nodes that have memory. All on-line nodes should have 1719 * devices of nodes that have memory. All on-line nodes should have
1720 * registered their associated sysdev by this time. 1720 * registered their associated device by this time.
1721 */ 1721 */
1722static void hugetlb_register_all_nodes(void) 1722static void hugetlb_register_all_nodes(void)
1723{ 1723{
@@ -1725,12 +1725,12 @@ static void hugetlb_register_all_nodes(void)
1725 1725
1726 for_each_node_state(nid, N_HIGH_MEMORY) { 1726 for_each_node_state(nid, N_HIGH_MEMORY) {
1727 struct node *node = &node_devices[nid]; 1727 struct node *node = &node_devices[nid];
1728 if (node->sysdev.id == nid) 1728 if (node->dev.id == nid)
1729 hugetlb_register_node(node); 1729 hugetlb_register_node(node);
1730 } 1730 }
1731 1731
1732 /* 1732 /*
1733 * Let the node sysdev driver know we're here so it can 1733 * Let the node device driver know we're here so it can
1734 * [un]register hstate attributes on node hotplug. 1734 * [un]register hstate attributes on node hotplug.
1735 */ 1735 */
1736 register_hugetlbfs_with_node(hugetlb_register_node, 1736 register_hugetlbfs_with_node(hugetlb_register_node,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f54a05b7a61d..11adc890ce30 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3475,16 +3475,16 @@ int scan_unevictable_handler(struct ctl_table *table, int write,
3475 * a specified node's per zone unevictable lists for evictable pages. 3475 * a specified node's per zone unevictable lists for evictable pages.
3476 */ 3476 */
3477 3477
3478static ssize_t read_scan_unevictable_node(struct sys_device *dev, 3478static ssize_t read_scan_unevictable_node(struct device *dev,
3479 struct sysdev_attribute *attr, 3479 struct device_attribute *attr,
3480 char *buf) 3480 char *buf)
3481{ 3481{
3482 warn_scan_unevictable_pages(); 3482 warn_scan_unevictable_pages();
3483 return sprintf(buf, "0\n"); /* always zero; should fit... */ 3483 return sprintf(buf, "0\n"); /* always zero; should fit... */
3484} 3484}
3485 3485
3486static ssize_t write_scan_unevictable_node(struct sys_device *dev, 3486static ssize_t write_scan_unevictable_node(struct device *dev,
3487 struct sysdev_attribute *attr, 3487 struct device_attribute *attr,
3488 const char *buf, size_t count) 3488 const char *buf, size_t count)
3489{ 3489{
3490 warn_scan_unevictable_pages(); 3490 warn_scan_unevictable_pages();
@@ -3492,17 +3492,17 @@ static ssize_t write_scan_unevictable_node(struct sys_device *dev,
3492} 3492}
3493 3493
3494 3494
3495static SYSDEV_ATTR(scan_unevictable_pages, S_IRUGO | S_IWUSR, 3495static DEVICE_ATTR(scan_unevictable_pages, S_IRUGO | S_IWUSR,
3496 read_scan_unevictable_node, 3496 read_scan_unevictable_node,
3497 write_scan_unevictable_node); 3497 write_scan_unevictable_node);
3498 3498
3499int scan_unevictable_register_node(struct node *node) 3499int scan_unevictable_register_node(struct node *node)
3500{ 3500{
3501 return sysdev_create_file(&node->sysdev, &attr_scan_unevictable_pages); 3501 return device_create_file(&node->dev, &dev_attr_scan_unevictable_pages);
3502} 3502}
3503 3503
3504void scan_unevictable_unregister_node(struct node *node) 3504void scan_unevictable_unregister_node(struct node *node)
3505{ 3505{
3506 sysdev_remove_file(&node->sysdev, &attr_scan_unevictable_pages); 3506 device_remove_file(&node->dev, &dev_attr_scan_unevictable_pages);
3507} 3507}
3508#endif 3508#endif
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
index c7dca7b0b9fe..ac2d5e10f1a8 100644
--- a/sound/usb/6fire/chip.c
+++ b/sound/usb/6fire/chip.c
@@ -211,22 +211,11 @@ static struct usb_device_id device_table[] = {
211 211
212MODULE_DEVICE_TABLE(usb, device_table); 212MODULE_DEVICE_TABLE(usb, device_table);
213 213
214static struct usb_driver driver = { 214static struct usb_driver usb_driver = {
215 .name = "snd-usb-6fire", 215 .name = "snd-usb-6fire",
216 .probe = usb6fire_chip_probe, 216 .probe = usb6fire_chip_probe,
217 .disconnect = usb6fire_chip_disconnect, 217 .disconnect = usb6fire_chip_disconnect,
218 .id_table = device_table, 218 .id_table = device_table,
219}; 219};
220 220
221static int __init usb6fire_chip_init(void) 221module_usb_driver(usb_driver);
222{
223 return usb_register(&driver);
224}
225
226static void __exit usb6fire_chip_cleanup(void)
227{
228 usb_deregister(&driver);
229}
230
231module_init(usb6fire_chip_init);
232module_exit(usb6fire_chip_cleanup);
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
index 3eb605bd9503..457fb274ff92 100644
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -538,16 +538,5 @@ static struct usb_driver snd_usb_driver = {
538 .id_table = snd_usb_id_table, 538 .id_table = snd_usb_id_table,
539}; 539};
540 540
541static int __init snd_module_init(void) 541module_usb_driver(snd_usb_driver);
542{
543 return usb_register(&snd_usb_driver);
544}
545
546static void __exit snd_module_exit(void)
547{
548 usb_deregister(&snd_usb_driver);
549}
550
551module_init(snd_module_init)
552module_exit(snd_module_exit)
553 542
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index c0609c210303..4c11da911a14 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -1387,16 +1387,4 @@ static struct usb_driver ua101_driver = {
1387#endif 1387#endif
1388}; 1388};
1389 1389
1390static int __init alsa_card_ua101_init(void) 1390module_usb_driver(ua101_driver);
1391{
1392 return usb_register(&ua101_driver);
1393}
1394
1395static void __exit alsa_card_ua101_exit(void)
1396{
1397 usb_deregister(&ua101_driver);
1398 mutex_destroy(&devices_mutex);
1399}
1400
1401module_init(alsa_card_ua101_init);
1402module_exit(alsa_card_ua101_exit);
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index 726c1a7b89b8..625f7ca6a894 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -772,16 +772,4 @@ static struct usb_driver snd_us122l_usb_driver = {
772 .supports_autosuspend = 1 772 .supports_autosuspend = 1
773}; 773};
774 774
775 775module_usb_driver(snd_us122l_usb_driver);
776static int __init snd_us122l_module_init(void)
777{
778 return usb_register(&snd_us122l_usb_driver);
779}
780
781static void __exit snd_us122l_module_exit(void)
782{
783 usb_deregister(&snd_us122l_usb_driver);
784}
785
786module_init(snd_us122l_module_init)
787module_exit(snd_us122l_module_exit)
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index cbd37f2c76d0..0c738ed3ed38 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -459,15 +459,4 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr)
459 } 459 }
460} 460}
461 461
462static int __init snd_usX2Y_module_init(void) 462module_usb_driver(snd_usX2Y_usb_driver);
463{
464 return usb_register(&snd_usX2Y_usb_driver);
465}
466
467static void __exit snd_usX2Y_module_exit(void)
468{
469 usb_deregister(&snd_usX2Y_usb_driver);
470}
471
472module_init(snd_usX2Y_module_init)
473module_exit(snd_usX2Y_module_exit)