]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
Merge branch 'driver-core-next' into Linux 3.2
authorGreg Kroah-Hartman <gregkh@suse.de>
Fri, 6 Jan 2012 19:42:52 +0000 (11:42 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 6 Jan 2012 19:42:52 +0000 (11:42 -0800)
This resolves the conflict in the arch/arm/mach-s3c64xx/s3c6400.c file,
and it fixes the build error in the arch/x86/kernel/microcode_core.c
file, that the merge did not catch.

The microcode_core.c patch was provided by Stephen Rothwell
<sfr@canb.auug.org.au> who was invaluable in the merge issues involved
with the large sysdev removal process in the driver-core tree.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
31 files changed:
1  2 
MAINTAINERS
arch/arm/mach-bcmring/core.c
arch/arm/mach-exynos/cpu.c
arch/arm/mach-s5pv210/mach-smdkv210.c
arch/powerpc/kernel/smp.c
arch/powerpc/mm/numa.c
arch/powerpc/platforms/cell/spu_base.c
arch/s390/kernel/topology.c
arch/tile/kernel/sysfs.c
arch/x86/include/asm/mce.h
arch/x86/kernel/cpu/mcheck/mce.c
arch/x86/kernel/hpet.c
arch/x86/kernel/microcode_core.c
drivers/base/core.c
drivers/base/node.c
drivers/bluetooth/btusb.c
drivers/leds/led-class.c
drivers/media/rc/ati_remote.c
drivers/net/bonding/bond_sysfs.c
drivers/net/usb/asix.c
drivers/net/usb/cdc_ether.c
drivers/net/usb/lg-vl600.c
drivers/net/usb/smsc75xx.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/usb/storage/ene_ub6250.c
include/linux/device.h
include/linux/i2c.h
kernel/sched.c
kernel/time/clocksource.c
mm/hugetlb.c
mm/vmscan.c

diff --combined MAINTAINERS
index 62f1cd357ddf76ef0cc1c63e4a38133a3935dbe0,a0f9fd1d7740f6b3e51f94765a1992f93261f2c3..f986e7dc904bda3c7e8290baef8679beb3b43b50
@@@ -511,8 -511,8 +511,8 @@@ M: Joerg Roedel <joerg.roedel@amd.com
  L:    iommu@lists.linux-foundation.org
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git
  S:    Supported
 -F:    arch/x86/kernel/amd_iommu*.c
 -F:    arch/x86/include/asm/amd_iommu*.h
 +F:    drivers/iommu/amd_iommu*.[ch]
 +F:    include/linux/amd-iommu.h
  
  AMD MICROCODE UPDATE SUPPORT
  M:    Andreas Herrmann <andreas.herrmann3@amd.com>
@@@ -789,7 -789,6 +789,7 @@@ L: linux-arm-kernel@lists.infradead.or
  S:    Maintained
  T:    git git://git.pengutronix.de/git/imx/linux-2.6.git
  F:    arch/arm/mach-mx*/
 +F:    arch/arm/mach-imx/
  F:    arch/arm/plat-mxc/
  
  ARM/FREESCALE IMX51
@@@ -805,13 -804,6 +805,13 @@@ S:       Maintaine
  T:    git git://git.linaro.org/people/shawnguo/linux-2.6.git
  F:    arch/arm/mach-imx/*imx6*
  
 +ARM/FREESCALE MXS ARM ARCHITECTURE
 +M:    Shawn Guo <shawn.guo@linaro.org>
 +L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 +S:    Maintained
 +T:    git git://git.linaro.org/people/shawnguo/linux-2.6.git
 +F:    arch/arm/mach-mxs/
 +
  ARM/GLOMATION GESBC9312SX MACHINE SUPPORT
  M:    Lennert Buytenhek <kernel@wantstofly.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@@ -1054,18 -1046,35 +1054,18 @@@ ARM/SAMSUNG ARM ARCHITECTURE
  M:    Ben Dooks <ben-linux@fluff.org>
  M:    Kukjin Kim <kgene.kim@samsung.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 +L:    linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
  W:    http://www.fluff.org/ben/linux/
  S:    Maintained
  F:    arch/arm/plat-samsung/
  F:    arch/arm/plat-s3c24xx/
  F:    arch/arm/plat-s5p/
 +F:    arch/arm/mach-s3c24*/
 +F:    arch/arm/mach-s3c64xx/
  F:    drivers/*/*s3c2410*
  F:    drivers/*/*/*s3c2410*
 -
 -ARM/S3C2410 ARM ARCHITECTURE
 -M:    Ben Dooks <ben-linux@fluff.org>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -W:    http://www.fluff.org/ben/linux/
 -S:    Maintained
 -F:    arch/arm/mach-s3c2410/
 -
 -ARM/S3C244x ARM ARCHITECTURE
 -M:    Ben Dooks <ben-linux@fluff.org>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -W:    http://www.fluff.org/ben/linux/
 -S:    Maintained
 -F:    arch/arm/mach-s3c2440/
 -F:    arch/arm/mach-s3c2443/
 -
 -ARM/S3C64xx ARM ARCHITECTURE
 -M:    Ben Dooks <ben-linux@fluff.org>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -W:    http://www.fluff.org/ben/linux/
 -S:    Maintained
 -F:    arch/arm/mach-s3c64xx/
 +F:    drivers/spi/spi-s3c*
 +F:    sound/soc/samsung/*
  
  ARM/S5P EXYNOS ARM ARCHITECTURES
  M:    Kukjin Kim <kgene.kim@samsung.com>
@@@ -1097,7 -1106,6 +1097,7 @@@ F:      drivers/media/video/s5p-fimc
  ARM/SAMSUNG S5P SERIES Multi Format Codec (MFC) SUPPORT
  M:    Kyungmin Park <kyungmin.park@samsung.com>
  M:    Kamil Debski <k.debski@samsung.com>
 +M:     Jeongtae Park <jtp.park@samsung.com>
  L:    linux-arm-kernel@lists.infradead.org
  L:    linux-media@vger.kernel.org
  S:    Maintained
@@@ -1698,9 -1706,11 +1698,9 @@@ F:     arch/x86/include/asm/tce.
  
  CAN NETWORK LAYER
  M:    Oliver Hartkopp <socketcan@hartkopp.net>
 -M:    Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
 -M:    Urs Thuermann <urs.thuermann@volkswagen.de>
  L:    linux-can@vger.kernel.org
 -L:    netdev@vger.kernel.org
 -W:    http://developer.berlios.de/projects/socketcan/
 +W:    http://gitorious.org/linux-can
 +T:    git git://gitorious.org/linux-can/linux-can-next.git
  S:    Maintained
  F:    net/can/
  F:    include/linux/can.h
@@@ -1711,10 -1721,9 +1711,10 @@@ F:    include/linux/can/gw.
  
  CAN NETWORK DRIVERS
  M:    Wolfgang Grandegger <wg@grandegger.com>
 +M:    Marc Kleine-Budde <mkl@pengutronix.de>
  L:    linux-can@vger.kernel.org
 -L:    netdev@vger.kernel.org
 -W:    http://developer.berlios.de/projects/socketcan/
 +W:    http://gitorious.org/linux-can
 +T:    git git://gitorious.org/linux-can/linux-can-next.git
  S:    Maintained
  F:    drivers/net/can/
  F:    include/linux/can/dev.h
@@@ -1779,14 -1788,6 +1779,14 @@@ F:    include/net/cfg80211.
  F:    net/wireless/*
  X:    net/wireless/wext*
  
 +CHAR and MISC DRIVERS
 +M:    Arnd Bergmann <arnd@arndb.de>
 +M:    Greg Kroah-Hartman <greg@kroah.com>
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
 +S:    Maintained
 +F:    drivers/char/*
 +F:    drivers/misc/*
 +
  CHECKPATCH
  M:    Andy Whitcroft <apw@canonical.com>
  S:    Supported
@@@ -1925,11 -1926,9 +1925,11 @@@ S:    Maintaine
  F:    drivers/connector/
  
  CONTROL GROUPS (CGROUPS)
 -M:    Paul Menage <paul@paulmenage.org>
 +M:    Tejun Heo <tj@kernel.org>
  M:    Li Zefan <lizf@cn.fujitsu.com>
  L:    containers@lists.linux-foundation.org
 +L:    cgroups@vger.kernel.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git
  S:    Maintained
  F:    include/linux/cgroup*
  F:    kernel/cgroup*
@@@ -2343,13 -2342,6 +2343,13 @@@ S:    Supporte
  F:    drivers/gpu/drm/i915
  F:    include/drm/i915*
  
 +DRM DRIVERS FOR EXYNOS
 +M:    Inki Dae <inki.dae@samsung.com>
 +L:    dri-devel@lists.freedesktop.org
 +S:    Supported
 +F:    drivers/gpu/drm/exynos
 +F:    include/drm/exynos*
 +
  DSCC4 DRIVER
  M:    Francois Romieu <romieu@fr.zoreil.com>
  L:    netdev@vger.kernel.org
@@@ -2584,7 -2576,7 +2584,7 @@@ S:      Maintaine
  F:    drivers/net/ethernet/i825xx/eexpress.*
  
  ETHERNET BRIDGE
 -M:    Stephen Hemminger <shemminger@linux-foundation.org>
 +M:    Stephen Hemminger <shemminger@vyatta.com>
  L:    bridge@lists.linux-foundation.org
  L:    netdev@vger.kernel.org
  W:    http://www.linuxfoundation.org/en/Net:Bridge
@@@ -2699,7 -2691,7 +2699,7 @@@ FIREWIRE SUBSYSTE
  M:    Stefan Richter <stefanr@s5r6.in-berlin.de>
  L:    linux1394-devel@lists.sourceforge.net
  W:    http://ieee1394.wiki.kernel.org/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git
  S:    Maintained
  F:    drivers/firewire/
  F:    include/linux/firewire*.h
@@@ -3100,7 -3092,6 +3100,7 @@@ F:      include/linux/hid
  
  HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS
  M:    Thomas Gleixner <tglx@linutronix.de>
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
  S:    Maintained
  F:    Documentation/timers/
  F:    kernel/hrtimer.c
@@@ -3610,7 -3601,7 +3610,7 @@@ F:      net/irda
  IRQ SUBSYSTEM
  M:    Thomas Gleixner <tglx@linutronix.de>
  S:    Maintained
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq/core
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
  F:    kernel/irq/
  
  ISAPNP
@@@ -3719,7 -3710,7 +3719,7 @@@ F:      fs/jbd2
  F:    include/linux/jbd2.h
  
  JSM Neo PCI based serial card
 -M:    Breno Leitao <leitao@linux.vnet.ibm.com>
 +M:    Lucas Tavares <lucaskt@linux.vnet.ibm.com>
  L:    linux-serial@vger.kernel.org
  S:    Maintained
  F:    drivers/tty/serial/jsm/
@@@ -4098,7 -4089,7 +4098,7 @@@ F:      drivers/hwmon/lm90.
  LOCKDEP AND LOCKSTAT
  M:    Peter Zijlstra <peterz@infradead.org>
  M:    Ingo Molnar <mingo@redhat.com>
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/locking
  S:    Maintained
  F:    Documentation/lockdep*.txt
  F:    Documentation/lockstat.txt
@@@ -4280,9 -4271,7 +4280,9 @@@ T:      git git://git.kernel.org/pub/scm/lin
  S:    Maintained
  F:    Documentation/dvb/
  F:    Documentation/video4linux/
 +F:    Documentation/DocBook/media/
  F:    drivers/media/
 +F:    drivers/staging/media/
  F:    include/media/
  F:    include/linux/dvb/
  F:    include/linux/videodev*.h
@@@ -4304,11 -4293,9 +4304,11 @@@ F:    include/linux/mm.
  F:    mm/
  
  MEMORY RESOURCE CONTROLLER
 +M:    Johannes Weiner <hannes@cmpxchg.org>
 +M:    Michal Hocko <mhocko@suse.cz>
  M:    Balbir Singh <bsingharora@gmail.com>
 -M:    Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
  M:    KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
 +L:    cgroups@vger.kernel.org
  L:    linux-mm@kvack.org
  S:    Maintained
  F:    mm/memcontrol.c
@@@ -4342,7 -4329,7 +4342,7 @@@ MIP
  M:    Ralf Baechle <ralf@linux-mips.org>
  L:    linux-mips@linux-mips.org
  W:    http://www.linux-mips.org/
 -T:    git git://git.linux-mips.org/pub/scm/linux.git
 +T:    git git://git.linux-mips.org/pub/scm/ralf/linux.git
  Q:    http://patchwork.linux-mips.org/project/linux-mips/list/
  S:    Supported
  F:    Documentation/mips/
@@@ -4475,7 -4462,7 +4475,7 @@@ S:      Supporte
  F:    drivers/infiniband/hw/nes/
  
  NETEM NETWORK EMULATOR
 -M:    Stephen Hemminger <shemminger@linux-foundation.org>
 +M:    Stephen Hemminger <shemminger@vyatta.com>
  L:    netem@lists.linux-foundation.org
  S:    Maintained
  F:    net/sched/sch_netem.c
@@@ -4952,7 -4939,7 +4952,7 @@@ F:      drivers/char/ppdev.
  F:    include/linux/ppdev.h
  
  PARAVIRT_OPS INTERFACE
 -M:    Jeremy Fitzhardinge <jeremy@xensource.com>
 +M:    Jeremy Fitzhardinge <jeremy@goop.org>
  M:    Chris Wright <chrisw@sous-sol.org>
  M:    Alok Kataria <akataria@vmware.com>
  M:    Rusty Russell <rusty@rustcorp.com.au>
@@@ -5088,7 -5075,6 +5088,7 @@@ M:      Peter Zijlstra <a.p.zijlstra@chello.
  M:    Paul Mackerras <paulus@samba.org>
  M:    Ingo Molnar <mingo@elte.hu>
  M:    Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
  S:    Supported
  F:    kernel/events/*
  F:    include/linux/perf_event.h
@@@ -5168,7 -5154,6 +5168,7 @@@ F:      drivers/scsi/pm8001
  
  POSIX CLOCKS and TIMERS
  M:    Thomas Gleixner <tglx@linutronix.de>
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
  S:    Supported
  F:    fs/timerfd.c
  F:    include/linux/timer*
@@@ -5663,6 -5648,7 +5663,6 @@@ F:      drivers/media/video/*7146
  F:    include/media/*7146*
  
  SAMSUNG AUDIO (ASoC) DRIVERS
 -M:    Jassi Brar <jassisinghbrar@gmail.com>
  M:    Sangbeom Kim <sbkim73@samsung.com>
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
  S:    Supported
@@@ -5684,7 -5670,6 +5684,7 @@@ F:      drivers/dma/dw_dmac.
  TIMEKEEPING, NTP
  M:    John Stultz <johnstul@us.ibm.com>
  M:    Thomas Gleixner <tglx@linutronix.de>
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
  S:    Supported
  F:    include/linux/clocksource.h
  F:    include/linux/time.h
@@@ -5709,7 -5694,6 +5709,7 @@@ F:      drivers/watchdog/sc1200wdt.
  SCHEDULER
  M:    Ingo Molnar <mingo@elte.hu>
  M:    Peter Zijlstra <peterz@infradead.org>
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
  S:    Maintained
  F:    kernel/sched*
  F:    include/linux/sched.h
@@@ -5993,7 -5977,7 +5993,7 @@@ S:      Maintaine
  F:    drivers/usb/misc/sisusbvga/
  
  SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS
 -M:    Stephen Hemminger <shemminger@linux-foundation.org>
 +M:    Stephen Hemminger <shemminger@vyatta.com>
  L:    netdev@vger.kernel.org
  S:    Maintained
  F:    drivers/net/ethernet/marvell/sk*
@@@ -6138,7 -6122,7 +6138,7 @@@ F:      sound
  SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
  M:    Liam Girdwood <lrg@ti.com>
  M:    Mark Brown <broonie@opensource.wolfsonmicro.com>
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
  W:    http://alsa-project.org/main/index.php/ASoC
  S:    Supported
@@@ -6258,7 -6242,7 +6258,7 @@@ F:      arch/alpha/kernel/srm_env.
  
  STABLE BRANCH
  M:    Greg Kroah-Hartman <greg@kroah.com>
- L:    stable@kernel.org
+ L:    stable@vger.kernel.org
  S:    Maintained
  
  STAGING SUBSYSTEM
@@@ -6637,7 -6621,7 +6637,7 @@@ TRACIN
  M:    Steven Rostedt <rostedt@goodmis.org>
  M:    Frederic Weisbecker <fweisbec@gmail.com>
  M:    Ingo Molnar <mingo@redhat.com>
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf/core
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
  S:    Maintained
  F:    Documentation/trace/ftrace.txt
  F:    arch/*/*/*/ftrace.h
@@@ -7387,7 -7371,7 +7387,7 @@@ M:      Thomas Gleixner <tglx@linutronix.de
  M:    Ingo Molnar <mingo@redhat.com>
  M:    "H. Peter Anvin" <hpa@zytor.com>
  M:    x86@kernel.org
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
  S:    Maintained
  F:    Documentation/x86/
  F:    arch/x86/
@@@ -7407,8 -7391,8 +7407,8 @@@ S:      Maintaine
  F:    arch/x86/kernel/cpu/mcheck/*
  
  XEN HYPERVISOR INTERFACE
 -M:    Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
  M:    Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
 +M:    Jeremy Fitzhardinge <jeremy@goop.org>
  L:    xen-devel@lists.xensource.com (moderated for non-subscribers)
  L:    virtualization@lists.linux-foundation.org
  S:    Supported
@@@ -7441,8 -7425,7 +7441,8 @@@ F:      drivers/xen/*swiotlb
  
  XFS FILESYSTEM
  P:    Silicon Graphics Inc
 -M:    Alex Elder <aelder@sgi.com>
 +M:    Ben Myers <bpm@sgi.com>
 +M:    Alex Elder <elder@kernel.org>
  M:    xfs-masters@oss.sgi.com
  L:    xfs@oss.sgi.com
  W:    http://oss.sgi.com/projects/xfs
index 430da120a297fe08620eaba672c65e283171bd99,31d84ae44c4cf3a4cc82f9352c838679adc41d88..6b67b7e8426ce8d313b84b910237b9848f5b7c23
@@@ -25,7 -25,6 +25,6 @@@
  #include <linux/device.h>
  #include <linux/dma-mapping.h>
  #include <linux/platform_device.h>
- #include <linux/sysdev.h>
  #include <linux/interrupt.h>
  #include <linux/amba/bus.h>
  #include <linux/clkdev.h>
@@@ -235,7 -234,7 +234,7 @@@ void __init bcmring_init_timer(void
         */
        bcmring_clocksource_init();
  
 -      sp804_clockevents_register(TIMER0_VA_BASE, IRQ_TIMER0, "timer0");
 +      sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMER0, "timer0");
  }
  
  struct sys_timer bcmring_timer = {
index cc8d4bd6d0f71666f4fe369dab28908bbd7af741,d4c41f349bcccee3525ff590ac45aeafdbb1fe8a..90a0297b77b8970c901291d9807ca04579192a9a
@@@ -9,7 -9,7 +9,7 @@@
  */
  
  #include <linux/sched.h>
- #include <linux/sysdev.h>
+ #include <linux/device.h>
  
  #include <asm/mach/map.h>
  #include <asm/mach/irq.h>
@@@ -110,6 -110,11 +110,6 @@@ static struct map_desc exynos4_iodesc[
                .pfn            = __phys_to_pfn(EXYNOS4_PA_DMC0),
                .length         = SZ_4K,
                .type           = MT_DEVICE,
 -      }, {
 -              .virtual        = (unsigned long)S5P_VA_SROMC,
 -              .pfn            = __phys_to_pfn(EXYNOS4_PA_SROMC),
 -              .length         = SZ_4K,
 -              .type           = MT_DEVICE,
        }, {
                .virtual        = (unsigned long)S3C_VA_USB_HSPHY,
                .pfn            = __phys_to_pfn(EXYNOS4_PA_HSPHY),
@@@ -238,17 -243,18 +238,18 @@@ void __init exynos4_init_irq(void
        s5p_init_irq(NULL, 0);
  }
  
- struct sysdev_class exynos4_sysclass = {
-       .name   = "exynos4-core",
+ struct bus_type exynos4_subsys = {
+       .name           = "exynos4-core",
+       .dev_name       = "exynos4-core",
  };
  
- static struct sys_device exynos4_sysdev = {
-       .cls    = &exynos4_sysclass,
+ static struct device exynos4_dev = {
+       .bus    = &exynos4_subsys,
  };
  
  static int __init exynos4_core_init(void)
  {
-       return sysdev_class_register(&exynos4_sysclass);
+       return subsys_system_register(&exynos4_subsys, NULL);
  }
  core_initcall(exynos4_core_init);
  
@@@ -289,5 -295,5 +290,5 @@@ int __init exynos_init(void
        if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412())
                s5p_reset_hook = exynos4_sw_reset;
  
-       return sysdev_register(&exynos4_sysdev);
+       return device_register(&exynos4_dev);
  }
index 8662ef6e5681a40df5eaaf7eb4dce07127e1b594,7d4d98916d69ea7bd87f39a918c42034712cb57c..69a99db6cc83a345b95cc597a2726aea28b5eda0
@@@ -13,7 -13,7 +13,7 @@@
  #include <linux/i2c.h>
  #include <linux/init.h>
  #include <linux/serial_core.h>
- #include <linux/sysdev.h>
+ #include <linux/device.h>
  #include <linux/dm9000.h>
  #include <linux/fb.h>
  #include <linux/gpio.h>
@@@ -273,7 -273,6 +273,7 @@@ static struct samsung_bl_gpio_info smdk
  
  static struct platform_pwm_backlight_data smdkv210_bl_data = {
        .pwm_id = 3,
 +      .pwm_period_ns = 1000,
  };
  
  static void __init smdkv210_map_io(void)
index 6df70907d60aba5cf244c5dade8ea007bc30425d,da08240353fa5f240467772ab651afdb861ccad7..d9a7a464ec514c0f0255e7293914db7d37a87004
@@@ -27,7 -27,7 +27,7 @@@
  #include <linux/spinlock.h>
  #include <linux/cache.h>
  #include <linux/err.h>
- #include <linux/sysdev.h>
+ #include <linux/device.h>
  #include <linux/cpu.h>
  #include <linux/notifier.h>
  #include <linux/topology.h>
@@@ -187,7 -187,7 +187,7 @@@ int smp_request_message_ipi(int virq, i
                return 1;
        }
  #endif
 -      err = request_irq(virq, smp_ipi_action[msg], IRQF_DISABLED|IRQF_PERCPU,
 +      err = request_irq(virq, smp_ipi_action[msg], IRQF_PERCPU,
                          smp_ipi_name[msg], 0);
        WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n",
                virq, smp_ipi_name[msg], err);
diff --combined arch/powerpc/mm/numa.c
index b22a83a91cb852b92d023529e3f1b3bf011dce38,f2b03a86343052f8bcac10ea5d27307c48e7d0b7..b088e985bee255e99f924cbf6984cc471f16ea5f
@@@ -315,10 -315,7 +315,10 @@@ static int __init find_min_common_depth
        struct device_node *root;
        const char *vec5;
  
 -      root = of_find_node_by_path("/rtas");
 +      if (firmware_has_feature(FW_FEATURE_OPAL))
 +              root = of_find_node_by_path("/ibm,opal");
 +      else
 +              root = of_find_node_by_path("/rtas");
        if (!root)
                root = of_find_node_by_path("/");
  
  
  #define VEC5_AFFINITY_BYTE    5
  #define VEC5_AFFINITY         0x80
 -      chosen = of_find_node_by_path("/chosen");
 -      if (chosen) {
 -              vec5 = of_get_property(chosen, "ibm,architecture-vec-5", NULL);
 -              if (vec5 && (vec5[VEC5_AFFINITY_BYTE] & VEC5_AFFINITY)) {
 -                      dbg("Using form 1 affinity\n");
 -                      form1_affinity = 1;
 +
 +      if (firmware_has_feature(FW_FEATURE_OPAL))
 +              form1_affinity = 1;
 +      else {
 +              chosen = of_find_node_by_path("/chosen");
 +              if (chosen) {
 +                      vec5 = of_get_property(chosen,
 +                                             "ibm,architecture-vec-5", NULL);
 +                      if (vec5 && (vec5[VEC5_AFFINITY_BYTE] &
 +                                                      VEC5_AFFINITY)) {
 +                              dbg("Using form 1 affinity\n");
 +                              form1_affinity = 1;
 +                      }
                }
        }
  
@@@ -1462,7 -1452,7 +1462,7 @@@ int arch_update_cpu_topology(void
  {
        int cpu, nid, old_nid;
        unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
-       struct sys_device *sysdev;
+       struct device *dev;
  
        for_each_cpu(cpu,&cpu_associativity_changes_mask) {
                vphn_get_associativity(cpu, associativity);
                register_cpu_under_node(cpu, nid);
                put_online_cpus();
  
-               sysdev = get_cpu_sysdev(cpu);
-               if (sysdev)
-                       kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
+               dev = get_cpu_device(cpu);
+               if (dev)
+                       kobject_uevent(&dev->kobj, KOBJ_CHANGE);
        }
  
        return 1;
index e94d3ecdd8bbc7ceff338c2016272103d5bbf2d4,1708fb7aba35a913b265a2b38374ddd55230c4cf..8b1213993b10ac581905edfefc0cbebe4cc5f435
@@@ -442,7 -442,8 +442,7 @@@ static int spu_request_irqs(struct spu 
                snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0",
                         spu->number);
                ret = request_irq(spu->irqs[0], spu_irq_class_0,
 -                                IRQF_DISABLED,
 -                                spu->irq_c0, spu);
 +                                0, spu->irq_c0, spu);
                if (ret)
                        goto bail0;
        }
                snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1",
                         spu->number);
                ret = request_irq(spu->irqs[1], spu_irq_class_1,
 -                                IRQF_DISABLED,
 -                                spu->irq_c1, spu);
 +                                0, spu->irq_c1, spu);
                if (ret)
                        goto bail1;
        }
                snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2",
                         spu->number);
                ret = request_irq(spu->irqs[2], spu_irq_class_2,
 -                                IRQF_DISABLED,
 -                                spu->irq_c2, spu);
 +                                0, spu->irq_c2, spu);
                if (ret)
                        goto bail2;
        }
@@@ -519,31 -522,32 +519,32 @@@ void spu_init_channels(struct spu *spu
  }
  EXPORT_SYMBOL_GPL(spu_init_channels);
  
- static struct sysdev_class spu_sysdev_class = {
+ static struct bus_type spu_subsys = {
        .name = "spu",
+       .dev_name = "spu",
  };
  
- int spu_add_sysdev_attr(struct sysdev_attribute *attr)
+ int spu_add_dev_attr(struct device_attribute *attr)
  {
        struct spu *spu;
  
        mutex_lock(&spu_full_list_mutex);
        list_for_each_entry(spu, &spu_full_list, full_list)
-               sysdev_create_file(&spu->sysdev, attr);
+               device_create_file(&spu->dev, attr);
        mutex_unlock(&spu_full_list_mutex);
  
        return 0;
  }
- EXPORT_SYMBOL_GPL(spu_add_sysdev_attr);
+ EXPORT_SYMBOL_GPL(spu_add_dev_attr);
  
- int spu_add_sysdev_attr_group(struct attribute_group *attrs)
+ int spu_add_dev_attr_group(struct attribute_group *attrs)
  {
        struct spu *spu;
        int rc = 0;
  
        mutex_lock(&spu_full_list_mutex);
        list_for_each_entry(spu, &spu_full_list, full_list) {
-               rc = sysfs_create_group(&spu->sysdev.kobj, attrs);
+               rc = sysfs_create_group(&spu->dev.kobj, attrs);
  
                /* we're in trouble here, but try unwinding anyway */
                if (rc) {
  
                        list_for_each_entry_continue_reverse(spu,
                                        &spu_full_list, full_list)
-                               sysfs_remove_group(&spu->sysdev.kobj, attrs);
+                               sysfs_remove_group(&spu->dev.kobj, attrs);
                        break;
                }
        }
  
        return rc;
  }
- EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group);
+ EXPORT_SYMBOL_GPL(spu_add_dev_attr_group);
  
  
- void spu_remove_sysdev_attr(struct sysdev_attribute *attr)
+ void spu_remove_dev_attr(struct device_attribute *attr)
  {
        struct spu *spu;
  
        mutex_lock(&spu_full_list_mutex);
        list_for_each_entry(spu, &spu_full_list, full_list)
-               sysdev_remove_file(&spu->sysdev, attr);
+               device_remove_file(&spu->dev, attr);
        mutex_unlock(&spu_full_list_mutex);
  }
- EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr);
+ EXPORT_SYMBOL_GPL(spu_remove_dev_attr);
  
- void spu_remove_sysdev_attr_group(struct attribute_group *attrs)
+ void spu_remove_dev_attr_group(struct attribute_group *attrs)
  {
        struct spu *spu;
  
        mutex_lock(&spu_full_list_mutex);
        list_for_each_entry(spu, &spu_full_list, full_list)
-               sysfs_remove_group(&spu->sysdev.kobj, attrs);
+               sysfs_remove_group(&spu->dev.kobj, attrs);
        mutex_unlock(&spu_full_list_mutex);
  }
- EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr_group);
+ EXPORT_SYMBOL_GPL(spu_remove_dev_attr_group);
  
- static int spu_create_sysdev(struct spu *spu)
+ static int spu_create_dev(struct spu *spu)
  {
        int ret;
  
-       spu->sysdev.id = spu->number;
-       spu->sysdev.cls = &spu_sysdev_class;
-       ret = sysdev_register(&spu->sysdev);
+       spu->dev.id = spu->number;
+       spu->dev.bus = &spu_subsys;
+       ret = device_register(&spu->dev);
        if (ret) {
                printk(KERN_ERR "Can't register SPU %d with sysfs\n",
                                spu->number);
                return ret;
        }
  
-       sysfs_add_device_to_node(&spu->sysdev, spu->node);
+       sysfs_add_device_to_node(&spu->dev, spu->node);
  
        return 0;
  }
@@@ -635,7 -639,7 +636,7 @@@ static int __init create_spu(void *data
        if (ret)
                goto out_destroy;
  
-       ret = spu_create_sysdev(spu);
+       ret = spu_create_dev(spu);
        if (ret)
                goto out_free_irqs;
  
@@@ -692,10 -696,10 +693,10 @@@ static unsigned long long spu_acct_time
  }
  
  
- static ssize_t spu_stat_show(struct sys_device *sysdev,
-                               struct sysdev_attribute *attr, char *buf)
+ static ssize_t spu_stat_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
  {
-       struct spu *spu = container_of(sysdev, struct spu, sysdev);
+       struct spu *spu = container_of(dev, struct spu, dev);
  
        return sprintf(buf, "%s %llu %llu %llu %llu "
                      "%llu %llu %llu %llu %llu %llu %llu %llu\n",
                spu->stats.libassist);
  }
  
- static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL);
+ static DEVICE_ATTR(stat, 0644, spu_stat_show, NULL);
  
  #ifdef CONFIG_KEXEC
  
@@@ -813,8 -817,8 +814,8 @@@ static int __init init_spu_base(void
        if (!spu_management_ops)
                goto out;
  
-       /* create sysdev class for spus */
-       ret = sysdev_class_register(&spu_sysdev_class);
+       /* create system subsystem for spus */
+       ret = subsys_system_register(&spu_subsys, NULL);
        if (ret)
                goto out;
  
        if (ret < 0) {
                printk(KERN_WARNING "%s: Error initializing spus\n",
                        __func__);
-               goto out_unregister_sysdev_class;
+               goto out_unregister_subsys;
        }
  
        if (ret > 0)
        xmon_register_spus(&spu_full_list);
        crash_register_spus(&spu_full_list);
        mutex_unlock(&spu_full_list_mutex);
-       spu_add_sysdev_attr(&attr_stat);
+       spu_add_dev_attr(&dev_attr_stat);
        register_syscore_ops(&spu_syscore_ops);
  
        spu_init_affinity();
  
        return 0;
  
-  out_unregister_sysdev_class:
-       sysdev_class_unregister(&spu_sysdev_class);
+  out_unregister_subsys:
+       bus_unregister(&spu_subsys);
   out:
        return ret;
  }
index fdb5b8cb260f683e1f4559f95c006a7838690f60,6dfc524c31aa8fac58e98a132368ace763a91de4..6e0e29b29a7b293b26c58dccd4946b9932e3cf9b
@@@ -68,10 -68,8 +68,10 @@@ static cpumask_t cpu_group_map(struct m
        return mask;
  }
  
 -static void add_cpus_to_mask(struct topology_cpu *tl_cpu,
 -                           struct mask_info *book, struct mask_info *core)
 +static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu,
 +                                        struct mask_info *book,
 +                                        struct mask_info *core,
 +                                        int z10)
  {
        unsigned int cpu;
  
                        cpu_book_id[lcpu] = book->id;
  #endif
                        cpumask_set_cpu(lcpu, &core->mask);
 -                      cpu_core_id[lcpu] = core->id;
 +                      if (z10) {
 +                              cpu_core_id[lcpu] = rcpu;
 +                              core = core->next;
 +                      } else {
 +                              cpu_core_id[lcpu] = core->id;
 +                      }
                        smp_cpu_polarization[lcpu] = tl_cpu->pp;
                }
        }
 +      return core;
  }
  
  static void clear_masks(void)
@@@ -131,41 -123,18 +131,41 @@@ static void tl_to_cores(struct sysinfo_
  {
  #ifdef CONFIG_SCHED_BOOK
        struct mask_info *book = &book_info;
 +      struct cpuid cpu_id;
  #else
        struct mask_info *book = NULL;
  #endif
        struct mask_info *core = &core_info;
        union topology_entry *tle, *end;
 +      int z10 = 0;
  
 -
 +#ifdef CONFIG_SCHED_BOOK
 +      get_cpu_id(&cpu_id);
 +      z10 = cpu_id.machine == 0x2097 || cpu_id.machine == 0x2098;
 +#endif
        spin_lock_irq(&topology_lock);
        clear_masks();
        tle = info->tle;
        end = (union topology_entry *)((unsigned long)info + info->length);
        while (tle < end) {
 +#ifdef CONFIG_SCHED_BOOK
 +              if (z10) {
 +                      switch (tle->nl) {
 +                      case 1:
 +                              book = book->next;
 +                              book->id = tle->container.id;
 +                              break;
 +                      case 0:
 +                              core = add_cpus_to_mask(&tle->cpu, book, core, z10);
 +                              break;
 +                      default:
 +                              clear_masks();
 +                              goto out;
 +                      }
 +                      tle = next_tle(tle);
 +                      continue;
 +              }
 +#endif
                switch (tle->nl) {
  #ifdef CONFIG_SCHED_BOOK
                case 2:
                        core->id = tle->container.id;
                        break;
                case 0:
 -                      add_cpus_to_mask(&tle->cpu, book, core);
 +                      add_cpus_to_mask(&tle->cpu, book, core, z10);
                        break;
                default:
                        clear_masks();
@@@ -261,7 -230,7 +261,7 @@@ void store_topology(struct sysinfo_15_1
  int arch_update_cpu_topology(void)
  {
        struct sysinfo_15_1_x *info = tl_info;
-       struct sys_device *sysdev;
+       struct device *dev;
        int cpu;
  
        if (!MACHINE_HAS_TOPOLOGY) {
        tl_to_cores(info);
        update_cpu_core_map();
        for_each_online_cpu(cpu) {
-               sysdev = get_cpu_sysdev(cpu);
-               kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
+               dev = get_cpu_device(cpu);
+               kobject_uevent(&dev->kobj, KOBJ_CHANGE);
        }
        return 1;
  }
@@@ -359,8 -328,8 +359,8 @@@ void __init s390_init_cpu_topology(void
        for (i = 0; i < TOPOLOGY_NR_MAG; i++)
                printk(" %d", info->mag[i]);
        printk(" / %d\n", info->mnest);
 -      alloc_masks(info, &core_info, 2);
 +      alloc_masks(info, &core_info, 1);
  #ifdef CONFIG_SCHED_BOOK
 -      alloc_masks(info, &book_info, 3);
 +      alloc_masks(info, &book_info, 2);
  #endif
  }
diff --combined arch/tile/kernel/sysfs.c
index 602908268093cf53397df895e68e240cc601d552,e7ce2a5161b8a26c6a2870a7788167fa1c83d115..f862b005eb73d22a3abc26ad74bddd0131a56e1b
   * /sys entry support.
   */
  
- #include <linux/sysdev.h>
+ #include <linux/device.h>
  #include <linux/cpu.h>
  #include <linux/slab.h>
  #include <linux/smp.h>
 +#include <linux/stat.h>
  #include <hv/hypervisor.h>
  
  /* Return a string queried from the hypervisor, truncated to page size. */
@@@ -32,55 -31,55 +32,55 @@@ static ssize_t get_hv_confstr(char *pag
        return n;
  }
  
- static ssize_t chip_width_show(struct sysdev_class *dev,
-                              struct sysdev_class_attribute *attr,
+ static ssize_t chip_width_show(struct device *dev,
+                              struct device_attribute *attr,
                               char *page)
  {
        return sprintf(page, "%u\n", smp_width);
  }
- static SYSDEV_CLASS_ATTR(chip_width, 0444, chip_width_show, NULL);
+ static DEVICE_ATTR(chip_width, 0444, chip_width_show, NULL);
  
- static ssize_t chip_height_show(struct sysdev_class *dev,
-                               struct sysdev_class_attribute *attr,
+ static ssize_t chip_height_show(struct device *dev,
+                               struct device_attribute *attr,
                                char *page)
  {
        return sprintf(page, "%u\n", smp_height);
  }
- static SYSDEV_CLASS_ATTR(chip_height, 0444, chip_height_show, NULL);
+ static DEVICE_ATTR(chip_height, 0444, chip_height_show, NULL);
  
- static ssize_t chip_serial_show(struct sysdev_class *dev,
-                               struct sysdev_class_attribute *attr,
+ static ssize_t chip_serial_show(struct device *dev,
+                               struct device_attribute *attr,
                                char *page)
  {
        return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM);
  }
- static SYSDEV_CLASS_ATTR(chip_serial, 0444, chip_serial_show, NULL);
+ static DEVICE_ATTR(chip_serial, 0444, chip_serial_show, NULL);
  
- static ssize_t chip_revision_show(struct sysdev_class *dev,
-                                 struct sysdev_class_attribute *attr,
+ static ssize_t chip_revision_show(struct device *dev,
+                                 struct device_attribute *attr,
                                  char *page)
  {
        return get_hv_confstr(page, HV_CONFSTR_CHIP_REV);
  }
- static SYSDEV_CLASS_ATTR(chip_revision, 0444, chip_revision_show, NULL);
+ static DEVICE_ATTR(chip_revision, 0444, chip_revision_show, NULL);
  
  
- static ssize_t type_show(struct sysdev_class *dev,
-                           struct sysdev_class_attribute *attr,
+ static ssize_t type_show(struct device *dev,
+                           struct device_attribute *attr,
                            char *page)
  {
        return sprintf(page, "tilera\n");
  }
- static SYSDEV_CLASS_ATTR(type, 0444, type_show, NULL);
+ static DEVICE_ATTR(type, 0444, type_show, NULL);
  
  #define HV_CONF_ATTR(name, conf)                                      \
-       static ssize_t name ## _show(struct sysdev_class *dev,          \
-                                    struct sysdev_class_attribute *attr, \
+       static ssize_t name ## _show(struct device *dev,                \
+                                    struct device_attribute *attr, \
                                     char *page)                        \
        {                                                               \
                return get_hv_confstr(page, conf);                      \
        }                                                               \
-       static SYSDEV_CLASS_ATTR(name, 0444, name ## _show, NULL);
+       static DEVICE_ATTR(name, 0444, name ## _show, NULL);
  
  HV_CONF_ATTR(version,         HV_CONFSTR_HV_SW_VER)
  HV_CONF_ATTR(config_version,  HV_CONFSTR_HV_CONFIG_VER)
@@@ -96,15 -95,15 +96,15 @@@ HV_CONF_ATTR(mezz_description,     HV_CONFS
  HV_CONF_ATTR(switch_control,  HV_CONFSTR_SWITCH_CONTROL)
  
  static struct attribute *board_attrs[] = {
-       &attr_board_part.attr,
-       &attr_board_serial.attr,
-       &attr_board_revision.attr,
-       &attr_board_description.attr,
-       &attr_mezz_part.attr,
-       &attr_mezz_serial.attr,
-       &attr_mezz_revision.attr,
-       &attr_mezz_description.attr,
-       &attr_switch_control.attr,
+       &dev_attr_board_part.attr,
+       &dev_attr_board_serial.attr,
+       &dev_attr_board_revision.attr,
+       &dev_attr_board_description.attr,
+       &dev_attr_mezz_part.attr,
+       &dev_attr_mezz_serial.attr,
+       &dev_attr_mezz_revision.attr,
+       &dev_attr_mezz_description.attr,
+       &dev_attr_switch_control.attr,
        NULL
  };
  
@@@ -151,12 -150,11 +151,11 @@@ hvconfig_bin_read(struct file *filp, st
  
  static int __init create_sysfs_entries(void)
  {
-       struct sysdev_class *cls = &cpu_sysdev_class;
        int err = 0;
  
  #define create_cpu_attr(name)                                         \
        if (!err)                                                       \
-               err = sysfs_create_file(&cls->kset.kobj, &attr_##name.attr);
+               err = device_create_file(cpu_subsys.dev_root, &dev_attr_##name);
        create_cpu_attr(chip_width);
        create_cpu_attr(chip_height);
        create_cpu_attr(chip_serial);
  
  #define create_hv_attr(name)                                          \
        if (!err)                                                       \
-               err = sysfs_create_file(hypervisor_kobj, &attr_##name.attr);
+               err = sysfs_create_file(hypervisor_kobj, &dev_attr_##name);
        create_hv_attr(type);
        create_hv_attr(version);
        create_hv_attr(config_version);
index 0e8ae57d3656c4576498b545826a5880214fe9e5,0b05fb49c560c466fa9b3e02ae2c8d72940424c0..7f06a19718a4525fff2dc0f179068f680a8a454c
@@@ -149,7 -149,7 +149,7 @@@ static inline void enable_p5_mce(void) 
  
  void mce_setup(struct mce *m);
  void mce_log(struct mce *m);
- DECLARE_PER_CPU(struct sys_device, mce_sysdev);
+ DECLARE_PER_CPU(struct device, mce_device);
  
  /*
   * Maximum banks number.
@@@ -201,10 -201,7 +201,10 @@@ int mce_notify_irq(void)
  void mce_notify_process(void);
  
  DECLARE_PER_CPU(struct mce, injectm);
 -extern struct file_operations mce_chrdev_ops;
 +
 +extern void register_mce_write_callback(ssize_t (*)(struct file *filp,
 +                                  const char __user *ubuf,
 +                                  size_t usize, loff_t *off));
  
  /*
   * Exception handler
index 2af127d4c3d1dc2ebdab3e0e2ff95d2d07595a46,0156c6f85d7bd82f49baf81b48a2eb9e04f1e94e..c83e3736ce28f2668e6f259e0a7ef6914043309a
@@@ -19,7 -19,7 +19,7 @@@
  #include <linux/kernel.h>
  #include <linux/percpu.h>
  #include <linux/string.h>
- #include <linux/sysdev.h>
+ #include <linux/device.h>
  #include <linux/syscore_ops.h>
  #include <linux/delay.h>
  #include <linux/ctype.h>
@@@ -1634,35 -1634,16 +1634,35 @@@ static long mce_chrdev_ioctl(struct fil
        }
  }
  
 -/* Modified in mce-inject.c, so not static or const */
 -struct file_operations mce_chrdev_ops = {
 +static ssize_t (*mce_write)(struct file *filp, const char __user *ubuf,
 +                          size_t usize, loff_t *off);
 +
 +void register_mce_write_callback(ssize_t (*fn)(struct file *filp,
 +                           const char __user *ubuf,
 +                           size_t usize, loff_t *off))
 +{
 +      mce_write = fn;
 +}
 +EXPORT_SYMBOL_GPL(register_mce_write_callback);
 +
 +ssize_t mce_chrdev_write(struct file *filp, const char __user *ubuf,
 +                       size_t usize, loff_t *off)
 +{
 +      if (mce_write)
 +              return mce_write(filp, ubuf, usize, off);
 +      else
 +              return -EINVAL;
 +}
 +
 +static const struct file_operations mce_chrdev_ops = {
        .open                   = mce_chrdev_open,
        .release                = mce_chrdev_release,
        .read                   = mce_chrdev_read,
 +      .write                  = mce_chrdev_write,
        .poll                   = mce_chrdev_poll,
        .unlocked_ioctl         = mce_chrdev_ioctl,
        .llseek                 = no_llseek,
  };
 -EXPORT_SYMBOL_GPL(mce_chrdev_ops);
  
  static struct miscdevice mce_chrdev_device = {
        MISC_MCELOG_MINOR,
@@@ -1770,7 -1751,7 +1770,7 @@@ static struct syscore_ops mce_syscore_o
  };
  
  /*
-  * mce_sysdev: Sysfs support
+  * mce_device: Sysfs support
   */
  
  static void mce_cpu_restart(void *data)
@@@ -1806,27 -1787,28 +1806,28 @@@ static void mce_enable_ce(void *all
                __mcheck_cpu_init_timer();
  }
  
- static struct sysdev_class mce_sysdev_class = {
+ static struct bus_type mce_subsys = {
        .name           = "machinecheck",
+       .dev_name       = "machinecheck",
  };
  
- DEFINE_PER_CPU(struct sys_device, mce_sysdev);
+ DEFINE_PER_CPU(struct device, mce_device);
  
  __cpuinitdata
  void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
  
- static inline struct mce_bank *attr_to_bank(struct sysdev_attribute *attr)
+ static inline struct mce_bank *attr_to_bank(struct device_attribute *attr)
  {
        return container_of(attr, struct mce_bank, attr);
  }
  
- static ssize_t show_bank(struct sys_device *s, struct sysdev_attribute *attr,
+ static ssize_t show_bank(struct device *s, struct device_attribute *attr,
                         char *buf)
  {
        return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl);
  }
  
- static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr,
+ static ssize_t set_bank(struct device *s, struct device_attribute *attr,
                        const char *buf, size_t size)
  {
        u64 new;
  }
  
  static ssize_t
- show_trigger(struct sys_device *s, struct sysdev_attribute *attr, char *buf)
+ show_trigger(struct device *s, struct device_attribute *attr, char *buf)
  {
        strcpy(buf, mce_helper);
        strcat(buf, "\n");
        return strlen(mce_helper) + 1;
  }
  
- static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr,
+ static ssize_t set_trigger(struct device *s, struct device_attribute *attr,
                                const char *buf, size_t siz)
  {
        char *p;
        return strlen(mce_helper) + !!p;
  }
  
- static ssize_t set_ignore_ce(struct sys_device *s,
-                            struct sysdev_attribute *attr,
+ static ssize_t set_ignore_ce(struct device *s,
+                            struct device_attribute *attr,
                             const char *buf, size_t size)
  {
        u64 new;
        return size;
  }
  
- static ssize_t set_cmci_disabled(struct sys_device *s,
-                                struct sysdev_attribute *attr,
+ static ssize_t set_cmci_disabled(struct device *s,
+                                struct device_attribute *attr,
                                 const char *buf, size_t size)
  {
        u64 new;
        return size;
  }
  
- static ssize_t store_int_with_restart(struct sys_device *s,
-                                     struct sysdev_attribute *attr,
+ static ssize_t store_int_with_restart(struct device *s,
+                                     struct device_attribute *attr,
                                      const char *buf, size_t size)
  {
-       ssize_t ret = sysdev_store_int(s, attr, buf, size);
+       ssize_t ret = device_store_int(s, attr, buf, size);
        mce_restart();
        return ret;
  }
  
- static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger);
- static SYSDEV_INT_ATTR(tolerant, 0644, tolerant);
- static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout);
- static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce);
+ static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger);
+ static DEVICE_INT_ATTR(tolerant, 0644, tolerant);
+ static DEVICE_INT_ATTR(monarch_timeout, 0644, monarch_timeout);
+ static DEVICE_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce);
  
- static struct sysdev_ext_attribute attr_check_interval = {
-       _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int,
-                    store_int_with_restart),
+ static struct dev_ext_attribute dev_attr_check_interval = {
+       __ATTR(check_interval, 0644, device_show_int, store_int_with_restart),
        &check_interval
  };
  
- static struct sysdev_ext_attribute attr_ignore_ce = {
-       _SYSDEV_ATTR(ignore_ce, 0644, sysdev_show_int, set_ignore_ce),
+ static struct dev_ext_attribute dev_attr_ignore_ce = {
+       __ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce),
        &mce_ignore_ce
  };
  
- static struct sysdev_ext_attribute attr_cmci_disabled = {
-       _SYSDEV_ATTR(cmci_disabled, 0644, sysdev_show_int, set_cmci_disabled),
+ static struct dev_ext_attribute dev_attr_cmci_disabled = {
+       __ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled),
        &mce_cmci_disabled
  };
  
- static struct sysdev_attribute *mce_sysdev_attrs[] = {
-       &attr_tolerant.attr,
-       &attr_check_interval.attr,
-       &attr_trigger,
-       &attr_monarch_timeout.attr,
-       &attr_dont_log_ce.attr,
-       &attr_ignore_ce.attr,
-       &attr_cmci_disabled.attr,
+ static struct device_attribute *mce_device_attrs[] = {
+       &dev_attr_tolerant.attr,
+       &dev_attr_check_interval.attr,
+       &dev_attr_trigger,
+       &dev_attr_monarch_timeout.attr,
+       &dev_attr_dont_log_ce.attr,
+       &dev_attr_ignore_ce.attr,
+       &dev_attr_cmci_disabled.attr,
        NULL
  };
  
- static cpumask_var_t mce_sysdev_initialized;
+ static cpumask_var_t mce_device_initialized;
  
- /* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */
- static __cpuinit int mce_sysdev_create(unsigned int cpu)
+ /* Per cpu device init. All of the cpus still share the same ctrl bank: */
+ static __cpuinit int mce_device_create(unsigned int cpu)
  {
-       struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu);
+       struct device *dev = &per_cpu(mce_device, cpu);
        int err;
        int i, j;
  
        if (!mce_available(&boot_cpu_data))
                return -EIO;
  
-       memset(&sysdev->kobj, 0, sizeof(struct kobject));
-       sysdev->id  = cpu;
-       sysdev->cls = &mce_sysdev_class;
+       memset(&dev->kobj, 0, sizeof(struct kobject));
+       dev->id  = cpu;
+       dev->bus = &mce_subsys;
  
-       err = sysdev_register(sysdev);
+       err = device_register(dev);
        if (err)
                return err;
  
-       for (i = 0; mce_sysdev_attrs[i]; i++) {
-               err = sysdev_create_file(sysdev, mce_sysdev_attrs[i]);
+       for (i = 0; mce_device_attrs[i]; i++) {
+               err = device_create_file(dev, mce_device_attrs[i]);
                if (err)
                        goto error;
        }
        for (j = 0; j < banks; j++) {
-               err = sysdev_create_file(sysdev, &mce_banks[j].attr);
+               err = device_create_file(dev, &mce_banks[j].attr);
                if (err)
                        goto error2;
        }
-       cpumask_set_cpu(cpu, mce_sysdev_initialized);
+       cpumask_set_cpu(cpu, mce_device_initialized);
  
        return 0;
  error2:
        while (--j >= 0)
-               sysdev_remove_file(sysdev, &mce_banks[j].attr);
+               device_remove_file(dev, &mce_banks[j].attr);
  error:
        while (--i >= 0)
-               sysdev_remove_file(sysdev, mce_sysdev_attrs[i]);
+               device_remove_file(dev, mce_device_attrs[i]);
  
-       sysdev_unregister(sysdev);
+       device_unregister(dev);
  
        return err;
  }
  
- static __cpuinit void mce_sysdev_remove(unsigned int cpu)
+ static __cpuinit void mce_device_remove(unsigned int cpu)
  {
-       struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu);
+       struct device *dev = &per_cpu(mce_device, cpu);
        int i;
  
-       if (!cpumask_test_cpu(cpu, mce_sysdev_initialized))
+       if (!cpumask_test_cpu(cpu, mce_device_initialized))
                return;
  
-       for (i = 0; mce_sysdev_attrs[i]; i++)
-               sysdev_remove_file(sysdev, mce_sysdev_attrs[i]);
+       for (i = 0; mce_device_attrs[i]; i++)
+               device_remove_file(dev, mce_device_attrs[i]);
  
        for (i = 0; i < banks; i++)
-               sysdev_remove_file(sysdev, &mce_banks[i].attr);
+               device_remove_file(dev, &mce_banks[i].attr);
  
-       sysdev_unregister(sysdev);
-       cpumask_clear_cpu(cpu, mce_sysdev_initialized);
+       device_unregister(dev);
+       cpumask_clear_cpu(cpu, mce_device_initialized);
  }
  
  /* Make sure there are no machine checks on offlined CPUs. */
@@@ -2061,7 -2042,7 +2061,7 @@@ mce_cpu_callback(struct notifier_block 
        switch (action) {
        case CPU_ONLINE:
        case CPU_ONLINE_FROZEN:
-               mce_sysdev_create(cpu);
+               mce_device_create(cpu);
                if (threshold_cpu_callback)
                        threshold_cpu_callback(action, cpu);
                break;
        case CPU_DEAD_FROZEN:
                if (threshold_cpu_callback)
                        threshold_cpu_callback(action, cpu);
-               mce_sysdev_remove(cpu);
+               mce_device_remove(cpu);
                break;
        case CPU_DOWN_PREPARE:
        case CPU_DOWN_PREPARE_FROZEN:
@@@ -2103,7 -2084,7 +2103,7 @@@ static __init void mce_init_banks(void
  
        for (i = 0; i < banks; i++) {
                struct mce_bank *b = &mce_banks[i];
-               struct sysdev_attribute *a = &b->attr;
+               struct device_attribute *a = &b->attr;
  
                sysfs_attr_init(&a->attr);
                a->attr.name    = b->attrname;
@@@ -2123,16 -2104,16 +2123,16 @@@ static __init int mcheck_init_device(vo
        if (!mce_available(&boot_cpu_data))
                return -EIO;
  
-       zalloc_cpumask_var(&mce_sysdev_initialized, GFP_KERNEL);
+       zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL);
  
        mce_init_banks();
  
-       err = sysdev_class_register(&mce_sysdev_class);
+       err = subsys_system_register(&mce_subsys, NULL);
        if (err)
                return err;
  
        for_each_online_cpu(i) {
-               err = mce_sysdev_create(i);
+               err = mce_device_create(i);
                if (err)
                        return err;
        }
diff --combined arch/x86/kernel/hpet.c
index 1bb0bf4d92cd8edf9d639ea5aabd08bc7efad892,98094a9580f73b9c87e76793bb06ce5df8e3b2af..56258f1c488e49206483c8a2ec7565289222b6f9
@@@ -2,7 -2,6 +2,6 @@@
  #include <linux/clockchips.h>
  #include <linux/interrupt.h>
  #include <linux/export.h>
- #include <linux/sysdev.h>
  #include <linux/delay.h>
  #include <linux/errno.h>
  #include <linux/i8253.h>
@@@ -1049,14 -1048,6 +1048,14 @@@ int hpet_rtc_timer_init(void
  }
  EXPORT_SYMBOL_GPL(hpet_rtc_timer_init);
  
 +static void hpet_disable_rtc_channel(void)
 +{
 +      unsigned long cfg;
 +      cfg = hpet_readl(HPET_T1_CFG);
 +      cfg &= ~HPET_TN_ENABLE;
 +      hpet_writel(cfg, HPET_T1_CFG);
 +}
 +
  /*
   * The functions below are called from rtc driver.
   * Return 0 if HPET is not being used.
@@@ -1068,9 -1059,6 +1067,9 @@@ int hpet_mask_rtc_irq_bit(unsigned lon
                return 0;
  
        hpet_rtc_flags &= ~bit_mask;
 +      if (unlikely(!hpet_rtc_flags))
 +              hpet_disable_rtc_channel();
 +
        return 1;
  }
  EXPORT_SYMBOL_GPL(hpet_mask_rtc_irq_bit);
@@@ -1136,11 -1124,15 +1135,11 @@@ EXPORT_SYMBOL_GPL(hpet_rtc_dropped_irq)
  
  static void hpet_rtc_timer_reinit(void)
  {
 -      unsigned int cfg, delta;
 +      unsigned int delta;
        int lost_ints = -1;
  
 -      if (unlikely(!hpet_rtc_flags)) {
 -              cfg = hpet_readl(HPET_T1_CFG);
 -              cfg &= ~HPET_TN_ENABLE;
 -              hpet_writel(cfg, HPET_T1_CFG);
 -              return;
 -      }
 +      if (unlikely(!hpet_rtc_flags))
 +              hpet_disable_rtc_channel();
  
        if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit)
                delta = hpet_default_delta;
index 9d46f5e43b51f0dd2b02ad0575c1e90470df862a,cf88f2a164735e05ccf88d77ba37d54e5979910f..c6aa7eb6cda40a0200b9657cfd6aabce476cfa3c
@@@ -256,7 -256,7 +256,7 @@@ static int __init microcode_dev_init(vo
        return 0;
  }
  
 -static void microcode_dev_exit(void)
 +static void __exit microcode_dev_exit(void)
  {
        misc_deregister(&microcode_dev);
  }
@@@ -292,8 -292,8 +292,8 @@@ static int reload_for_cpu(int cpu
        return err;
  }
  
- static ssize_t reload_store(struct sys_device *dev,
-                           struct sysdev_attribute *attr,
+ static ssize_t reload_store(struct device *dev,
+                           struct device_attribute *attr,
                            const char *buf, size_t size)
  {
        unsigned long val;
        return ret;
  }
  
- static ssize_t version_show(struct sys_device *dev,
-                       struct sysdev_attribute *attr, char *buf)
+ static ssize_t version_show(struct device *dev,
+                       struct device_attribute *attr, char *buf)
  {
        struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
  
        return sprintf(buf, "0x%x\n", uci->cpu_sig.rev);
  }
  
- static ssize_t pf_show(struct sys_device *dev,
-                       struct sysdev_attribute *attr, char *buf)
+ static ssize_t pf_show(struct device *dev,
+                       struct device_attribute *attr, char *buf)
  {
        struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
  
        return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
  }
  
- static SYSDEV_ATTR(reload, 0200, NULL, reload_store);
- static SYSDEV_ATTR(version, 0400, version_show, NULL);
- static SYSDEV_ATTR(processor_flags, 0400, pf_show, NULL);
+ static DEVICE_ATTR(reload, 0200, NULL, reload_store);
+ static DEVICE_ATTR(version, 0400, version_show, NULL);
+ static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
  
  static struct attribute *mc_default_attrs[] = {
-       &attr_reload.attr,
-       &attr_version.attr,
-       &attr_processor_flags.attr,
+       &dev_attr_reload.attr,
+       &dev_attr_version.attr,
+       &dev_attr_processor_flags.attr,
        NULL
  };
  
@@@ -405,43 -405,45 +405,45 @@@ static enum ucode_state microcode_updat
        return ustate;
  }
  
- static int mc_sysdev_add(struct sys_device *sys_dev)
+ static int mc_device_add(struct device *dev, struct subsys_interface *sif)
  {
-       int err, cpu = sys_dev->id;
+       int err, cpu = dev->id;
  
        if (!cpu_online(cpu))
                return 0;
  
        pr_debug("CPU%d added\n", cpu);
  
-       err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group);
+       err = sysfs_create_group(&dev->kobj, &mc_attr_group);
        if (err)
                return err;
  
        if (microcode_init_cpu(cpu) == UCODE_ERROR) {
-               sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
+               sysfs_remove_group(&dev->kobj, &mc_attr_group);
                return -EINVAL;
        }
  
        return err;
  }
  
- static int mc_sysdev_remove(struct sys_device *sys_dev)
+ static int mc_device_remove(struct device *dev, struct subsys_interface *sif)
  {
-       int cpu = sys_dev->id;
+       int cpu = dev->id;
  
        if (!cpu_online(cpu))
                return 0;
  
        pr_debug("CPU%d removed\n", cpu);
        microcode_fini_cpu(cpu);
-       sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
+       sysfs_remove_group(&dev->kobj, &mc_attr_group);
        return 0;
  }
  
- static struct sysdev_driver mc_sysdev_driver = {
-       .add                    = mc_sysdev_add,
-       .remove                 = mc_sysdev_remove,
+ static struct subsys_interface mc_cpu_interface = {
+       .name                   = "microcode",
+       .subsys                 = &cpu_subsys,
+       .add_dev                = mc_device_add,
+       .remove_dev             = mc_device_remove,
  };
  
  /**
@@@ -464,9 -466,9 +466,9 @@@ static __cpuinit in
  mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
  {
        unsigned int cpu = (unsigned long)hcpu;
-       struct sys_device *sys_dev;
+       struct device *dev;
  
-       sys_dev = get_cpu_sysdev(cpu);
+       dev = get_cpu_device(cpu);
        switch (action) {
        case CPU_ONLINE:
        case CPU_ONLINE_FROZEN:
        case CPU_DOWN_FAILED:
        case CPU_DOWN_FAILED_FROZEN:
                pr_debug("CPU%d added\n", cpu);
-               if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group))
+               if (sysfs_create_group(&dev->kobj, &mc_attr_group))
                        pr_err("Failed to create group for CPU%d\n", cpu);
                break;
        case CPU_DOWN_PREPARE:
        case CPU_DOWN_PREPARE_FROZEN:
                /* Suspend is in progress, only remove the interface */
-               sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
+               sysfs_remove_group(&dev->kobj, &mc_attr_group);
                pr_debug("CPU%d removed\n", cpu);
                break;
  
@@@ -519,23 -521,27 +521,23 @@@ static int __init microcode_init(void
  
        microcode_pdev = platform_device_register_simple("microcode", -1,
                                                         NULL, 0);
 -      if (IS_ERR(microcode_pdev)) {
 -              microcode_dev_exit();
 +      if (IS_ERR(microcode_pdev))
                return PTR_ERR(microcode_pdev);
 -      }
  
        get_online_cpus();
        mutex_lock(&microcode_mutex);
  
-       error = sysdev_driver_register(&cpu_sysdev_class, &mc_sysdev_driver);
+       error = subsys_interface_register(&mc_cpu_interface);
  
        mutex_unlock(&microcode_mutex);
        put_online_cpus();
  
 -      if (error) {
 -              platform_device_unregister(microcode_pdev);
 -              return error;
 -      }
 +      if (error)
 +              goto out_pdev;
  
        error = microcode_dev_init();
        if (error)
-               goto out_sysdev_driver;
 -              return error;
++              goto out_driver;
  
        register_syscore_ops(&mc_syscore_ops);
        register_hotcpu_notifier(&mc_cpu_notifier);
                " <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n");
  
        return 0;
- out_sysdev_driver:
 +
-       sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver);
++out_driver:
 +      get_online_cpus();
 +      mutex_lock(&microcode_mutex);
 +
++      subsys_interface_unregister(&mc_cpu_interface);
 +
 +      mutex_unlock(&microcode_mutex);
 +      put_online_cpus();
 +
 +out_pdev:
 +      platform_device_unregister(microcode_pdev);
 +      return error;
 +
  }
  module_init(microcode_init);
  
@@@ -571,7 -563,7 +573,7 @@@ static void __exit microcode_exit(void
        get_online_cpus();
        mutex_lock(&microcode_mutex);
  
-       sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver);
+       subsys_interface_unregister(&mc_cpu_interface);
  
        mutex_unlock(&microcode_mutex);
        put_online_cpus();
diff --combined drivers/base/core.c
index 919daa7cd5b1db3443c65863cc07c20c830f680b,a31ea193fba04b7f6fe4258ee71ff8874834eec5..4dac58aa4a0a1c7e3fd5b0aab1b786a4b32f14fc
@@@ -22,7 -22,6 +22,7 @@@
  #include <linux/kallsyms.h>
  #include <linux/mutex.h>
  #include <linux/async.h>
 +#include <linux/pm_runtime.h>
  
  #include "base.h"
  #include "power/power.h"
@@@ -118,6 -117,56 +118,56 @@@ static const struct sysfs_ops dev_sysfs
        .store  = dev_attr_store,
  };
  
+ #define to_ext_attr(x) container_of(x, struct dev_ext_attribute, attr)
+ ssize_t device_store_ulong(struct device *dev,
+                          struct device_attribute *attr,
+                          const char *buf, size_t size)
+ {
+       struct dev_ext_attribute *ea = to_ext_attr(attr);
+       char *end;
+       unsigned long new = simple_strtoul(buf, &end, 0);
+       if (end == buf)
+               return -EINVAL;
+       *(unsigned long *)(ea->var) = new;
+       /* Always return full write size even if we didn't consume all */
+       return size;
+ }
+ EXPORT_SYMBOL_GPL(device_store_ulong);
+ ssize_t device_show_ulong(struct device *dev,
+                         struct device_attribute *attr,
+                         char *buf)
+ {
+       struct dev_ext_attribute *ea = to_ext_attr(attr);
+       return snprintf(buf, PAGE_SIZE, "%lx\n", *(unsigned long *)(ea->var));
+ }
+ EXPORT_SYMBOL_GPL(device_show_ulong);
+ ssize_t device_store_int(struct device *dev,
+                        struct device_attribute *attr,
+                        const char *buf, size_t size)
+ {
+       struct dev_ext_attribute *ea = to_ext_attr(attr);
+       char *end;
+       long new = simple_strtol(buf, &end, 0);
+       if (end == buf || new > INT_MAX || new < INT_MIN)
+               return -EINVAL;
+       *(int *)(ea->var) = new;
+       /* Always return full write size even if we didn't consume all */
+       return size;
+ }
+ EXPORT_SYMBOL_GPL(device_store_int);
+ ssize_t device_show_int(struct device *dev,
+                       struct device_attribute *attr,
+                       char *buf)
+ {
+       struct dev_ext_attribute *ea = to_ext_attr(attr);
+       return snprintf(buf, PAGE_SIZE, "%d\n", *(int *)(ea->var));
+ }
+ EXPORT_SYMBOL_GPL(device_show_int);
  
  /**
   *    device_release - free device structure.
@@@ -464,7 -513,7 +514,7 @@@ static ssize_t show_dev(struct device *
  static struct device_attribute devt_attr =
        __ATTR(dev, S_IRUGO, show_dev, NULL);
  
- /* kset to create /sys/devices/  */
+ /* /sys/devices/ */
  struct kset *devices_kset;
  
  /**
@@@ -711,6 -760,10 +761,10 @@@ static struct kobject *get_device_paren
                return k;
        }
  
+       /* subsystems can specify a default root directory for their devices */
+       if (!parent && dev->bus && dev->bus->dev_root)
+               return &dev->bus->dev_root->kobj;
        if (parent)
                return &parent->kobj;
        return NULL;
@@@ -731,14 -784,6 +785,6 @@@ static void cleanup_device_parent(struc
        cleanup_glue_dir(dev, dev->kobj.parent);
  }
  
- static void setup_parent(struct device *dev, struct device *parent)
- {
-       struct kobject *kobj;
-       kobj = get_device_parent(dev, parent);
-       if (kobj)
-               dev->kobj.parent = kobj;
- }
  static int device_add_class_symlinks(struct device *dev)
  {
        int error;
@@@ -891,6 -936,7 +937,7 @@@ int device_private_init(struct device *
  int device_add(struct device *dev)
  {
        struct device *parent = NULL;
+       struct kobject *kobj;
        struct class_interface *class_intf;
        int error = -EINVAL;
  
                dev->init_name = NULL;
        }
  
+       /* subsystems can specify simple device enumeration */
+       if (!dev_name(dev) && dev->bus && dev->bus->dev_name)
+               dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id);
        if (!dev_name(dev)) {
                error = -EINVAL;
                goto name_error;
        pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
  
        parent = get_device(dev->parent);
-       setup_parent(dev, parent);
+       kobj = get_device_parent(dev, parent);
+       if (kobj)
+               dev->kobj.parent = kobj;
  
        /* use parent numa_node */
        if (parent)
                               &parent->p->klist_children);
  
        if (dev->class) {
-               mutex_lock(&dev->class->p->class_mutex);
+               mutex_lock(&dev->class->p->mutex);
                /* tie the class to the device */
                klist_add_tail(&dev->knode_class,
                               &dev->class->p->klist_devices);
  
                /* notify any interfaces that the device is here */
                list_for_each_entry(class_intf,
-                                   &dev->class->p->class_interfaces, node)
+                                   &dev->class->p->interfaces, node)
                        if (class_intf->add_dev)
                                class_intf->add_dev(dev, class_intf);
-               mutex_unlock(&dev->class->p->class_mutex);
+               mutex_unlock(&dev->class->p->mutex);
        }
  done:
        put_device(dev);
@@@ -1107,15 -1159,15 +1160,15 @@@ void device_del(struct device *dev
        if (dev->class) {
                device_remove_class_symlinks(dev);
  
-               mutex_lock(&dev->class->p->class_mutex);
+               mutex_lock(&dev->class->p->mutex);
                /* notify any interfaces that the device is now gone */
                list_for_each_entry(class_intf,
-                                   &dev->class->p->class_interfaces, node)
+                                   &dev->class->p->interfaces, node)
                        if (class_intf->remove_dev)
                                class_intf->remove_dev(dev, class_intf);
                /* remove the device from the class list */
                klist_del(&dev->knode_class);
-               mutex_unlock(&dev->class->p->class_mutex);
+               mutex_unlock(&dev->class->p->mutex);
        }
        device_remove_file(dev, &uevent_attr);
        device_remove_attrs(dev);
@@@ -1744,10 -1796,6 +1797,10 @@@ void device_shutdown(void
                list_del_init(&dev->kobj.entry);
                spin_unlock(&devices_kset->list_lock);
  
 +              /* Don't allow any more runtime suspends */
 +              pm_runtime_get_noresume(dev);
 +              pm_runtime_barrier(dev);
 +
                if (dev->bus && dev->bus->shutdown) {
                        dev_dbg(dev, "shutdown\n");
                        dev->bus->shutdown(dev);
diff --combined drivers/base/node.c
index 5693ecee9a4052a339b9eca105ff3704fffe29b4,996d2189689b807f80854ecf444dfe5cad5b3a4a..44f427a6611724e710efc0591e8ba9777cf5dcbd
@@@ -1,8 -1,7 +1,7 @@@
  /*
-  * drivers/base/node.c - basic Node class support
+  * Basic Node interface support
   */
  
- #include <linux/sysdev.h>
  #include <linux/module.h>
  #include <linux/init.h>
  #include <linux/mm.h>
  #include <linux/swap.h>
  #include <linux/slab.h>
  
- static struct sysdev_class_attribute *node_state_attrs[];
- static struct sysdev_class node_class = {
+ static struct bus_type node_subsys = {
        .name = "node",
-       .attrs = node_state_attrs,
+       .dev_name = "node",
  };
  
  
- static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf)
+ static ssize_t node_read_cpumap(struct device *dev, int type, char *buf)
  {
        struct node *node_dev = to_node(dev);
-       const struct cpumask *mask = cpumask_of_node(node_dev->sysdev.id);
+       const struct cpumask *mask = cpumask_of_node(node_dev->dev.id);
        int len;
  
        /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */
        return len;
  }
  
- static inline ssize_t node_read_cpumask(struct sys_device *dev,
-                               struct sysdev_attribute *attr, char *buf)
+ static inline ssize_t node_read_cpumask(struct device *dev,
+                               struct device_attribute *attr, char *buf)
  {
        return node_read_cpumap(dev, 0, buf);
  }
- static inline ssize_t node_read_cpulist(struct sys_device *dev,
-                               struct sysdev_attribute *attr, char *buf)
+ static inline ssize_t node_read_cpulist(struct device *dev,
+                               struct device_attribute *attr, char *buf)
  {
        return node_read_cpumap(dev, 1, buf);
  }
  
- static SYSDEV_ATTR(cpumap,  S_IRUGO, node_read_cpumask, NULL);
- static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL);
+ static DEVICE_ATTR(cpumap,  S_IRUGO, node_read_cpumask, NULL);
+ static DEVICE_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL);
  
  #define K(x) ((x) << (PAGE_SHIFT - 10))
- static ssize_t node_read_meminfo(struct sys_device * dev,
-                       struct sysdev_attribute *attr, char * buf)
+ static ssize_t node_read_meminfo(struct device *dev,
+                       struct device_attribute *attr, char *buf)
  {
        int n;
        int nid = dev->id;
                       nid, K(node_page_state(nid, NR_WRITEBACK)),
                       nid, K(node_page_state(nid, NR_FILE_PAGES)),
                       nid, K(node_page_state(nid, NR_FILE_MAPPED)),
 -                     nid, K(node_page_state(nid, NR_ANON_PAGES)
  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 +                     nid, K(node_page_state(nid, NR_ANON_PAGES)
                        + node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
 -                      HPAGE_PMD_NR
 +                      HPAGE_PMD_NR),
 +#else
 +                     nid, K(node_page_state(nid, NR_ANON_PAGES)),
  #endif
 -                     ),
                       nid, K(node_page_state(nid, NR_SHMEM)),
                       nid, node_page_state(nid, NR_KERNEL_STACK) *
                                THREAD_SIZE / 1024,
                       nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) +
                                node_page_state(nid, NR_SLAB_UNRECLAIMABLE)),
                       nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)),
 -                     nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 +                     nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
                        , nid,
                        K(node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
 -                      HPAGE_PMD_NR)
 +                      HPAGE_PMD_NR));
 +#else
 +                     nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));
  #endif
 -                     );
        n += hugetlb_report_node_meminfo(nid, buf + n);
        return n;
  }
  
  #undef K
- static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL);
+ static DEVICE_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL);
  
- static ssize_t node_read_numastat(struct sys_device * dev,
-                               struct sysdev_attribute *attr, char * buf)
+ static ssize_t node_read_numastat(struct device *dev,
+                               struct device_attribute *attr, char *buf)
  {
        return sprintf(buf,
                       "numa_hit %lu\n"
                       node_page_state(dev->id, NUMA_LOCAL),
                       node_page_state(dev->id, NUMA_OTHER));
  }
- static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
+ static DEVICE_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
  
- static ssize_t node_read_vmstat(struct sys_device *dev,
-                               struct sysdev_attribute *attr, char *buf)
+ static ssize_t node_read_vmstat(struct device *dev,
+                               struct device_attribute *attr, char *buf)
  {
        int nid = dev->id;
        int i;
  
        return n;
  }
- static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);
+ static DEVICE_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);
  
- static ssize_t node_read_distance(struct sys_device * dev,
-                       struct sysdev_attribute *attr, char * buf)
+ static ssize_t node_read_distance(struct device *dev,
+                       struct device_attribute *attr, char * buf)
  {
        int nid = dev->id;
        int len = 0;
        len += sprintf(buf + len, "\n");
        return len;
  }
- static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
+ static DEVICE_ATTR(distance, S_IRUGO, node_read_distance, NULL);
  
  #ifdef CONFIG_HUGETLBFS
  /*
@@@ -230,7 -225,7 +227,7 @@@ static node_registration_func_t __huget
  static inline bool hugetlb_register_node(struct node *node)
  {
        if (__hugetlb_register_node &&
-                       node_state(node->sysdev.id, N_HIGH_MEMORY)) {
+                       node_state(node->dev.id, N_HIGH_MEMORY)) {
                __hugetlb_register_node(node);
                return true;
        }
@@@ -266,17 -261,17 +263,17 @@@ int register_node(struct node *node, in
  {
        int error;
  
-       node->sysdev.id = num;
-       node->sysdev.cls = &node_class;
-       error = sysdev_register(&node->sysdev);
+       node->dev.id = num;
+       node->dev.bus = &node_subsys;
+       error = device_register(&node->dev);
  
        if (!error){
-               sysdev_create_file(&node->sysdev, &attr_cpumap);
-               sysdev_create_file(&node->sysdev, &attr_cpulist);
-               sysdev_create_file(&node->sysdev, &attr_meminfo);
-               sysdev_create_file(&node->sysdev, &attr_numastat);
-               sysdev_create_file(&node->sysdev, &attr_distance);
-               sysdev_create_file(&node->sysdev, &attr_vmstat);
+               device_create_file(&node->dev, &dev_attr_cpumap);
+               device_create_file(&node->dev, &dev_attr_cpulist);
+               device_create_file(&node->dev, &dev_attr_meminfo);
+               device_create_file(&node->dev, &dev_attr_numastat);
+               device_create_file(&node->dev, &dev_attr_distance);
+               device_create_file(&node->dev, &dev_attr_vmstat);
  
                scan_unevictable_register_node(node);
  
   */
  void unregister_node(struct node *node)
  {
-       sysdev_remove_file(&node->sysdev, &attr_cpumap);
-       sysdev_remove_file(&node->sysdev, &attr_cpulist);
-       sysdev_remove_file(&node->sysdev, &attr_meminfo);
-       sysdev_remove_file(&node->sysdev, &attr_numastat);
-       sysdev_remove_file(&node->sysdev, &attr_distance);
-       sysdev_remove_file(&node->sysdev, &attr_vmstat);
+       device_remove_file(&node->dev, &dev_attr_cpumap);
+       device_remove_file(&node->dev, &dev_attr_cpulist);
+       device_remove_file(&node->dev, &dev_attr_meminfo);
+       device_remove_file(&node->dev, &dev_attr_numastat);
+       device_remove_file(&node->dev, &dev_attr_distance);
+       device_remove_file(&node->dev, &dev_attr_vmstat);
  
        scan_unevictable_unregister_node(node);
        hugetlb_unregister_node(node);          /* no-op, if memoryless node */
  
-       sysdev_unregister(&node->sysdev);
+       device_unregister(&node->dev);
  }
  
  struct node node_devices[MAX_NUMNODES];
  int register_cpu_under_node(unsigned int cpu, unsigned int nid)
  {
        int ret;
-       struct sys_device *obj;
+       struct device *obj;
  
        if (!node_online(nid))
                return 0;
  
-       obj = get_cpu_sysdev(cpu);
+       obj = get_cpu_device(cpu);
        if (!obj)
                return 0;
  
-       ret = sysfs_create_link(&node_devices[nid].sysdev.kobj,
+       ret = sysfs_create_link(&node_devices[nid].dev.kobj,
                                &obj->kobj,
                                kobject_name(&obj->kobj));
        if (ret)
                return ret;
  
        return sysfs_create_link(&obj->kobj,
-                                &node_devices[nid].sysdev.kobj,
-                                kobject_name(&node_devices[nid].sysdev.kobj));
+                                &node_devices[nid].dev.kobj,
+                                kobject_name(&node_devices[nid].dev.kobj));
  }
  
  int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
  {
-       struct sys_device *obj;
+       struct device *obj;
  
        if (!node_online(nid))
                return 0;
  
-       obj = get_cpu_sysdev(cpu);
+       obj = get_cpu_device(cpu);
        if (!obj)
                return 0;
  
-       sysfs_remove_link(&node_devices[nid].sysdev.kobj,
+       sysfs_remove_link(&node_devices[nid].dev.kobj,
                          kobject_name(&obj->kobj));
        sysfs_remove_link(&obj->kobj,
-                         kobject_name(&node_devices[nid].sysdev.kobj));
+                         kobject_name(&node_devices[nid].dev.kobj));
  
        return 0;
  }
@@@ -393,15 -388,15 +390,15 @@@ int register_mem_sect_under_node(struc
                        continue;
                if (page_nid != nid)
                        continue;
-               ret = sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj,
-                                       &mem_blk->sysdev.kobj,
-                                       kobject_name(&mem_blk->sysdev.kobj));
+               ret = sysfs_create_link_nowarn(&node_devices[nid].dev.kobj,
+                                       &mem_blk->dev.kobj,
+                                       kobject_name(&mem_blk->dev.kobj));
                if (ret)
                        return ret;
  
-               return sysfs_create_link_nowarn(&mem_blk->sysdev.kobj,
-                               &node_devices[nid].sysdev.kobj,
-                               kobject_name(&node_devices[nid].sysdev.kobj));
+               return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
+                               &node_devices[nid].dev.kobj,
+                               kobject_name(&node_devices[nid].dev.kobj));
        }
        /* mem section does not span the specified node */
        return 0;
@@@ -434,10 -429,10 +431,10 @@@ int unregister_mem_sect_under_nodes(str
                        continue;
                if (node_test_and_set(nid, *unlinked_nodes))
                        continue;
-               sysfs_remove_link(&node_devices[nid].sysdev.kobj,
-                        kobject_name(&mem_blk->sysdev.kobj));
-               sysfs_remove_link(&mem_blk->sysdev.kobj,
-                        kobject_name(&node_devices[nid].sysdev.kobj));
+               sysfs_remove_link(&node_devices[nid].dev.kobj,
+                        kobject_name(&mem_blk->dev.kobj));
+               sysfs_remove_link(&mem_blk->dev.kobj,
+                        kobject_name(&node_devices[nid].dev.kobj));
        }
        NODEMASK_FREE(unlinked_nodes);
        return 0;
@@@ -468,7 -463,7 +465,7 @@@ static int link_mem_sections(int nid
        }
  
        if (mem_blk)
-               kobject_put(&mem_blk->sysdev.kobj);
+               kobject_put(&mem_blk->dev.kobj);
        return err;
  }
  
@@@ -596,19 -591,19 +593,19 @@@ static ssize_t print_nodes_state(enum n
  }
  
  struct node_attr {
-       struct sysdev_class_attribute attr;
+       struct device_attribute attr;
        enum node_states state;
  };
  
- static ssize_t show_node_state(struct sysdev_class *class,
-                              struct sysdev_class_attribute *attr, char *buf)
+ static ssize_t show_node_state(struct device *dev,
+                              struct device_attribute *attr, char *buf)
  {
        struct node_attr *na = container_of(attr, struct node_attr, attr);
        return print_nodes_state(na->state, buf);
  }
  
  #define _NODE_ATTR(name, state) \
-       { _SYSDEV_CLASS_ATTR(name, 0444, show_node_state, NULL), state }
+       { __ATTR(name, 0444, show_node_state, NULL), state }
  
  static struct node_attr node_state_attr[] = {
        _NODE_ATTR(possible, N_POSSIBLE),
  #endif
  };
  
- static struct sysdev_class_attribute *node_state_attrs[] = {
-       &node_state_attr[0].attr,
-       &node_state_attr[1].attr,
-       &node_state_attr[2].attr,
-       &node_state_attr[3].attr,
+ static struct attribute *node_state_attrs[] = {
+       &node_state_attr[0].attr.attr,
+       &node_state_attr[1].attr.attr,
+       &node_state_attr[2].attr.attr,
+       &node_state_attr[3].attr.attr,
  #ifdef CONFIG_HIGHMEM
-       &node_state_attr[4].attr,
+       &node_state_attr[4].attr.attr,
  #endif
        NULL
  };
  
+ static struct attribute_group memory_root_attr_group = {
+       .attrs = node_state_attrs,
+ };
+ static const struct attribute_group *cpu_root_attr_groups[] = {
+       &memory_root_attr_group,
+       NULL,
+ };
  #define NODE_CALLBACK_PRI     2       /* lower than SLAB */
  static int __init register_node_type(void)
  {
        BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES);
        BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES);
  
-       ret = sysdev_class_register(&node_class);
+       ret = subsys_system_register(&node_subsys, cpu_root_attr_groups);
        if (!ret) {
                hotplug_memory_notifier(node_memory_callback,
                                        NODE_CALLBACK_PRI);
index eabc437ce5002a507b3fcf17973abc1b4baffc59,b0e6d8d5b96a655193bf57841d0e6070943de27f..0c3e179b758900c2cf21f5de01f50f1d95463675
@@@ -100,9 -100,6 +100,9 @@@ static struct usb_device_id btusb_table
        /* Canyon CN-BTU1 with HID interfaces */
        { USB_DEVICE(0x0c10, 0x0000) },
  
 +      /* Broadcom BCM20702A0 */
 +      { USB_DEVICE(0x413c, 0x8197) },
 +
        { }     /* Terminating entry */
  };
  
@@@ -777,8 -774,9 +777,8 @@@ skip_waking
                usb_mark_last_busy(data->udev);
        }
  
 -      usb_free_urb(urb);
 -
  done:
 +      usb_free_urb(urb);
        return err;
  }
  
@@@ -1222,20 -1220,7 +1222,7 @@@ static struct usb_driver btusb_driver 
        .supports_autosuspend = 1,
  };
  
- static int __init btusb_init(void)
- {
-       BT_INFO("Generic Bluetooth USB driver ver %s", VERSION);
-       return usb_register(&btusb_driver);
- }
- static void __exit btusb_exit(void)
- {
-       usb_deregister(&btusb_driver);
- }
- module_init(btusb_init);
- module_exit(btusb_exit);
+ module_usb_driver(btusb_driver);
  
  module_param(ignore_dga, bool, 0644);
  MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001");
diff --combined drivers/leds/led-class.c
index 6d5628bb060115d6e3f032210f9bc862a0ef397b,cc068d3a3244c35fee809e41f07c982ad78c17db..0c8739c448b1ebfe20edfa0868696b3b8e9d50e5
@@@ -15,7 -15,6 +15,6 @@@
  #include <linux/list.h>
  #include <linux/spinlock.h>
  #include <linux/device.h>
- #include <linux/sysdev.h>
  #include <linux/timer.h>
  #include <linux/err.h>
  #include <linux/ctype.h>
@@@ -270,8 -269,11 +269,8 @@@ void led_blink_set(struct led_classdev 
        del_timer_sync(&led_cdev->blink_timer);
  
        if (led_cdev->blink_set &&
 -          !led_cdev->blink_set(led_cdev, delay_on, delay_off)) {
 -              led_cdev->blink_delay_on = *delay_on;
 -              led_cdev->blink_delay_off = *delay_off;
 +          !led_cdev->blink_set(led_cdev, delay_on, delay_off))
                return;
 -      }
  
        /* blink with 1 Hz as default if nothing specified */
        if (!*delay_on && !*delay_off)
index 01bb8daf4b09f43c8b153c7a099e85d851e1b249,4363bc38aab0d22638669f145256a2be09ce1f6e..baf907b3ce764added4954d40408e84bd16fa2e3
@@@ -189,7 -189,7 +189,7 @@@ struct ati_remote 
        dma_addr_t inbuf_dma;
        dma_addr_t outbuf_dma;
  
 -      unsigned char old_data[2];  /* Detect duplicate events */
 +      unsigned char old_data;     /* Detect duplicate events */
        unsigned long old_jiffies;
        unsigned long acc_jiffies;  /* handle acceleration */
        unsigned long first_jiffies;
  /* Translation table from hardware messages to input events. */
  static const struct {
        short kind;
 -      unsigned char data1, data2;
 +      unsigned char data;
        int type;
        unsigned int code;
        int value;
  }  ati_remote_tbl[] = {
        /* Directional control pad axes */
 -      {KIND_ACCEL,   0x35, 0x70, EV_REL, REL_X, -1},   /* left */
 -      {KIND_ACCEL,   0x36, 0x71, EV_REL, REL_X, 1},    /* right */
 -      {KIND_ACCEL,   0x37, 0x72, EV_REL, REL_Y, -1},   /* up */
 -      {KIND_ACCEL,   0x38, 0x73, EV_REL, REL_Y, 1},    /* down */
 +      {KIND_ACCEL,   0x70, EV_REL, REL_X, -1},   /* left */
 +      {KIND_ACCEL,   0x71, EV_REL, REL_X, 1},    /* right */
 +      {KIND_ACCEL,   0x72, EV_REL, REL_Y, -1},   /* up */
 +      {KIND_ACCEL,   0x73, EV_REL, REL_Y, 1},    /* down */
        /* Directional control pad diagonals */
 -      {KIND_LU,      0x39, 0x74, EV_REL, 0, 0},        /* left up */
 -      {KIND_RU,      0x3a, 0x75, EV_REL, 0, 0},        /* right up */
 -      {KIND_LD,      0x3c, 0x77, EV_REL, 0, 0},        /* left down */
 -      {KIND_RD,      0x3b, 0x76, EV_REL, 0, 0},        /* right down */
 +      {KIND_LU,      0x74, EV_REL, 0, 0},        /* left up */
 +      {KIND_RU,      0x75, EV_REL, 0, 0},        /* right up */
 +      {KIND_LD,      0x77, EV_REL, 0, 0},        /* left down */
 +      {KIND_RD,      0x76, EV_REL, 0, 0},        /* right down */
  
        /* "Mouse button" buttons */
 -      {KIND_LITERAL, 0x3d, 0x78, EV_KEY, BTN_LEFT, 1}, /* left btn down */
 -      {KIND_LITERAL, 0x3e, 0x79, EV_KEY, BTN_LEFT, 0}, /* left btn up */
 -      {KIND_LITERAL, 0x41, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */
 -      {KIND_LITERAL, 0x42, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */
 +      {KIND_LITERAL, 0x78, EV_KEY, BTN_LEFT, 1}, /* left btn down */
 +      {KIND_LITERAL, 0x79, EV_KEY, BTN_LEFT, 0}, /* left btn up */
 +      {KIND_LITERAL, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */
 +      {KIND_LITERAL, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */
  
        /* Artificial "doubleclick" events are generated by the hardware.
         * They are mapped to the "side" and "extra" mouse buttons here. */
 -      {KIND_FILTERED, 0x3f, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */
 -      {KIND_FILTERED, 0x43, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */
 +      {KIND_FILTERED, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */
 +      {KIND_FILTERED, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */
  
        /* Non-mouse events are handled by rc-core */
 -      {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0}
 +      {KIND_END, 0x00, EV_MAX + 1, 0, 0}
  };
  
  /* Local function prototypes */
@@@ -396,6 -396,25 +396,6 @@@ static int ati_remote_sendpacket(struc
        return retval;
  }
  
 -/*
 - *    ati_remote_event_lookup
 - */
 -static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2)
 -{
 -      int i;
 -
 -      for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) {
 -              /*
 -               * Decide if the table entry matches the remote input.
 -               */
 -              if (ati_remote_tbl[i].data1 == d1 &&
 -                  ati_remote_tbl[i].data2 == d2)
 -                      return i;
 -
 -      }
 -      return -1;
 -}
 -
  /*
   *    ati_remote_compute_accel
   *
@@@ -444,15 -463,7 +444,15 @@@ static void ati_remote_input_report(str
        int index = -1;
        int acc;
        int remote_num;
 -      unsigned char scancode[2];
 +      unsigned char scancode;
 +      int i;
 +
 +      /*
 +       * data[0] = 0x14
 +       * data[1] = data[2] + data[3] + 0xd5 (a checksum byte)
 +       * data[2] = the key code (with toggle bit in MSB with some models)
 +       * data[3] = channel << 4 (the low 4 bits must be zero)
 +       */
  
        /* Deal with strange looking inputs */
        if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
                return;
        }
  
 +      if (data[1] != ((data[2] + data[3] + 0xd5) & 0xff)) {
 +              dbginfo(&ati_remote->interface->dev,
 +                      "wrong checksum in input: %02x %02x %02x %02x\n",
 +                      data[0], data[1], data[2], data[3]);
 +              return;
 +      }
 +
        /* Mask unwanted remote channels.  */
        /* note: remote_num is 0-based, channel 1 on remote == 0 here */
        remote_num = (data[3] >> 4) & 0x0f;
                return;
        }
  
 -      scancode[0] = (((data[1] - ((remote_num + 1) << 4)) & 0xf0) | (data[1] & 0x0f));
 -
        /*
 -       * Some devices (e.g. SnapStream Firefly) use 8080 as toggle code,
 -       * so we have to clear them. The first bit is a bit tricky as the
 -       * "non-toggled" state depends on remote_num, so we xor it with the
 -       * second bit which is only used for toggle.
 +       * MSB is a toggle code, though only used by some devices
 +       * (e.g. SnapStream Firefly)
         */
 -      scancode[0] ^= (data[2] & 0x80);
 -
 -      scancode[1] = data[2] & ~0x80;
 +      scancode = data[2] & 0x7f;
  
 -      /* Look up event code index in mouse translation table. */
 -      index = ati_remote_event_lookup(remote_num, scancode[0], scancode[1]);
 +      /* Look up event code index in the mouse translation table. */
 +      for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) {
 +              if (scancode == ati_remote_tbl[i].data) {
 +                      index = i;
 +                      break;
 +              }
 +      }
  
        if (index >= 0) {
                dbginfo(&ati_remote->interface->dev,
 -                      "channel 0x%02x; mouse data %02x,%02x; index %d; keycode %d\n",
 -                      remote_num, data[1], data[2], index, ati_remote_tbl[index].code);
 +                      "channel 0x%02x; mouse data %02x; index %d; keycode %d\n",
 +                      remote_num, data[2], index, ati_remote_tbl[index].code);
                if (!dev)
                        return; /* no mouse device */
        } else
                dbginfo(&ati_remote->interface->dev,
 -                      "channel 0x%02x; key data %02x,%02x, scancode %02x,%02x\n",
 -                      remote_num, data[1], data[2], scancode[0], scancode[1]);
 +                      "channel 0x%02x; key data %02x, scancode %02x\n",
 +                      remote_num, data[2], scancode);
  
  
        if (index >= 0 && ati_remote_tbl[index].kind == KIND_LITERAL) {
                unsigned long now = jiffies;
  
                /* Filter duplicate events which happen "too close" together. */
 -              if (ati_remote->old_data[0] == data[1] &&
 -                  ati_remote->old_data[1] == data[2] &&
 +              if (ati_remote->old_data == data[2] &&
                    time_before(now, ati_remote->old_jiffies +
                                     msecs_to_jiffies(repeat_filter))) {
                        ati_remote->repeat_count++;
                        ati_remote->first_jiffies = now;
                }
  
 -              ati_remote->old_data[0] = data[1];
 -              ati_remote->old_data[1] = data[2];
 +              ati_remote->old_data = data[2];
                ati_remote->old_jiffies = now;
  
                /* Ensure we skip at least the 4 first duplicate events (generated
  
                if (index < 0) {
                        /* Not a mouse event, hand it to rc-core. */
 -                      u32 rc_code = (scancode[0] << 8) | scancode[1];
  
                        /*
                         * We don't use the rc-core repeat handling yet as
                         * it would cause ghost repeats which would be a
                         * regression for this driver.
                         */
 -                      rc_keydown_notimeout(ati_remote->rdev, rc_code,
 +                      rc_keydown_notimeout(ati_remote->rdev, scancode,
                                             data[2]);
                        rc_keyup(ati_remote->rdev);
                        return;
                input_sync(dev);
  
                ati_remote->old_jiffies = jiffies;
 -              ati_remote->old_data[0] = data[1];
 -              ati_remote->old_data[1] = data[2];
 +              ati_remote->old_data = data[2];
        }
  }
  
@@@ -899,38 -908,7 +899,7 @@@ static void ati_remote_disconnect(struc
        kfree(ati_remote);
  }
  
- /*
-  *    ati_remote_init
-  */
- static int __init ati_remote_init(void)
- {
-       int result;
-       result = usb_register(&ati_remote_driver);
-       if (result)
-               printk(KERN_ERR KBUILD_MODNAME
-                      ": usb_register error #%d\n", result);
-       else
-               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-                      DRIVER_DESC "\n");
-       return result;
- }
- /*
-  *    ati_remote_exit
-  */
- static void __exit ati_remote_exit(void)
- {
-       usb_deregister(&ati_remote_driver);
- }
- /*
-  *    module specification
-  */
- module_init(ati_remote_init);
- module_exit(ati_remote_exit);
+ module_usb_driver(ati_remote_driver);
  
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
index 4ef7e2fd9fe6f5b577c13fc56a5b2ae45a54a0bd,549742f23ad5cd44bf3346d7c01f32aa33201dea..aef42f045320ae86eed4014835f90ccd786d1586
@@@ -26,7 -26,6 +26,6 @@@
  #include <linux/module.h>
  #include <linux/device.h>
  #include <linux/sched.h>
- #include <linux/sysdev.h>
  #include <linux/fs.h>
  #include <linux/types.h>
  #include <linux/string.h>
@@@ -319,13 -318,6 +318,13 @@@ static ssize_t bonding_store_mode(struc
                goto out;
        }
  
 +      if (bond->slave_cnt > 0) {
 +              pr_err("unable to update mode of %s because it has slaves.\n",
 +                      bond->dev->name);
 +              ret = -EPERM;
 +              goto out;
 +      }
 +
        new_value = bond_parse_parm(buf, bond_mode_tbl);
        if (new_value < 0)  {
                pr_err("%s: Ignoring invalid mode value %.*s.\n",
diff --combined drivers/net/usb/asix.c
index e95f0e60a9bc7bc9dd18587986c53e5af8f79d42,97a1cc7ce6848cd5a547b1707c3105dcb09244ca..823715ac1277a1810b49781b199eab1b28c99ed4
@@@ -36,7 -36,7 +36,7 @@@
  #include <linux/usb/usbnet.h>
  #include <linux/slab.h>
  
 -#define DRIVER_VERSION "26-Sep-2011"
 +#define DRIVER_VERSION "08-Nov-2011"
  #define DRIVER_NAME "asix"
  
  /* ASIX AX8817X based USB 2.0 Ethernet Devices */
  #define MARVELL_CTRL_TXDELAY  0x0002
  #define MARVELL_CTRL_RXDELAY  0x0080
  
 -#define       PHY_MODE_RTL8211CL      0x0004
 +#define       PHY_MODE_RTL8211CL      0x000C
  
  /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
  struct asix_data {
@@@ -652,17 -652,9 +652,17 @@@ static u32 asix_get_phyid(struct usbne
  {
        int phy_reg;
        u32 phy_id;
 +      int i;
  
 -      phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1);
 -      if (phy_reg < 0)
 +      /* Poll for the rare case the FW or phy isn't ready yet.  */
 +      for (i = 0; i < 100; i++) {
 +              phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1);
 +              if (phy_reg != 0 && phy_reg != 0xFFFF)
 +                      break;
 +              mdelay(1);
 +      }
 +
 +      if (phy_reg <= 0 || phy_reg == 0xFFFF)
                return 0;
  
        phy_id = (phy_reg & 0xffff) << 16;
@@@ -1083,7 -1075,7 +1083,7 @@@ static const struct net_device_ops ax88
  
  static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
  {
 -      int ret;
 +      int ret, embd_phy;
        struct asix_data *data = (struct asix_data *)&dev->data;
        u8 buf[ETH_ALEN];
        u32 phyid;
        dev->mii.reg_num_mask = 0x1f;
        dev->mii.phy_id = asix_get_phy_addr(dev);
  
 -      phyid = asix_get_phyid(dev);
 -      dbg("PHYID=0x%08x", phyid);
 -
        dev->net->netdev_ops = &ax88772_netdev_ops;
        dev->net->ethtool_ops = &ax88772_ethtool_ops;
  
 -      ret = ax88772_reset(dev);
 +      embd_phy = ((dev->mii.phy_id & 0x1f) == 0x10 ? 1 : 0);
 +
 +      /* Reset the PHY to normal operation mode */
 +      ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
 +      if (ret < 0) {
 +              dbg("Select PHY #1 failed: %d", ret);
 +              return ret;
 +      }
 +
 +      ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL);
 +      if (ret < 0)
 +              return ret;
 +
 +      msleep(150);
 +
 +      ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
        if (ret < 0)
                return ret;
  
 +      msleep(150);
 +
 +      ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE);
 +
 +      /* Read PHYID register *AFTER* the PHY was reset properly */
 +      phyid = asix_get_phyid(dev);
 +      dbg("PHYID=0x%08x", phyid);
 +
        /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
        if (dev->driver_info->flags & FLAG_FRAMING_AX) {
                /* hard_mtu  is still the default - the device does not support
@@@ -1248,7 -1220,6 +1248,7 @@@ static int ax88178_reset(struct usbnet 
        __le16 eeprom;
        u8 status;
        int gpio0 = 0;
 +      u32 phyid;
  
        asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
        dbg("GPIO Status: 0x%04x", status);
                data->ledmode = 0;
                gpio0 = 1;
        } else {
 -              data->phymode = le16_to_cpu(eeprom) & 7;
 +              data->phymode = le16_to_cpu(eeprom) & 0x7F;
                data->ledmode = le16_to_cpu(eeprom) >> 8;
                gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
        }
        dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode);
  
 +      /* Power up external GigaPHY through AX88178 GPIO pin */
        asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
        if ((le16_to_cpu(eeprom) >> 8) != 1) {
                asix_write_gpio(dev, 0x003c, 30);
                asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30);
        }
  
 +      /* Read PHYID register *AFTER* powering up PHY */
 +      phyid = asix_get_phyid(dev);
 +      dbg("PHYID=0x%08x", phyid);
 +
 +      /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */
 +      asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL);
 +
        asix_sw_reset(dev, 0);
        msleep(150);
  
@@@ -1433,6 -1396,7 +1433,6 @@@ static int ax88178_bind(struct usbnet *
  {
        int ret;
        u8 buf[ETH_ALEN];
 -      u32 phyid;
        struct asix_data *data = (struct asix_data *)&dev->data;
  
        data->eeprom_len = AX88772_EEPROM_LEN;
        dev->net->netdev_ops = &ax88178_netdev_ops;
        dev->net->ethtool_ops = &ax88178_ethtool_ops;
  
 -      phyid = asix_get_phyid(dev);
 -      dbg("PHYID=0x%08x", phyid);
 +      /* Blink LEDS so users know driver saw dongle */
 +      asix_sw_reset(dev, 0);
 +      msleep(150);
  
 -      ret = ax88178_reset(dev);
 -      if (ret < 0)
 -              return ret;
 +      asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD);
 +      msleep(150);
  
        /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
        if (dev->driver_info->flags & FLAG_FRAMING_AX) {
@@@ -1655,10 -1619,6 +1655,10 @@@ static const struct usb_device_id     produ
        // ASIX 88772a
        USB_DEVICE(0x0db0, 0xa877),
        .driver_info = (unsigned long) &ax88772_info,
 +}, {
 +      // Asus USB Ethernet Adapter
 +      USB_DEVICE (0x0b95, 0x7e2b),
 +      .driver_info = (unsigned long) &ax88772_info,
  },
        { },            // END
  };
@@@ -1674,17 -1634,7 +1674,7 @@@ static struct usb_driver asix_driver = 
        .supports_autosuspend = 1,
  };
  
- static int __init asix_init(void)
- {
-       return usb_register(&asix_driver);
- }
- module_init(asix_init);
- static void __exit asix_exit(void)
- {
-       usb_deregister(&asix_driver);
- }
- module_exit(asix_exit);
+ module_usb_driver(asix_driver);
  
  MODULE_AUTHOR("David Hollis");
  MODULE_VERSION(DRIVER_VERSION);
index 99ed6eb4dfaf6b8b1153dbe9bfcb4e5917500986,26637c3542994ec6c652f967dde411104197ea90..41a61efc331ef9f206979f1e2477503d3a8ed289
@@@ -425,6 -425,9 +425,9 @@@ int usbnet_cdc_bind(struct usbnet *dev
        int                             status;
        struct cdc_state                *info = (void *) &dev->data;
  
+       BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
+                       < sizeof(struct cdc_state)));
        status = usbnet_generic_cdc_bind(dev, intf);
        if (status < 0)
                return status;
@@@ -567,7 -570,7 +570,7 @@@ static const struct usb_device_id  produ
  {
        USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
                        USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
 -      .driver_info = (unsigned long)&wwan_info,
 +      .driver_info = 0,
  },
  
  /*
@@@ -615,21 -618,7 +618,7 @@@ static struct usb_driver cdc_driver = 
        .supports_autosuspend = 1,
  };
  
- static int __init cdc_init(void)
- {
-       BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
-                       < sizeof(struct cdc_state)));
-       return usb_register(&cdc_driver);
- }
- module_init(cdc_init);
- static void __exit cdc_exit(void)
- {
-       usb_deregister(&cdc_driver);
- }
- module_exit(cdc_exit);
+ module_usb_driver(cdc_driver);
  
  MODULE_AUTHOR("David Brownell");
  MODULE_DESCRIPTION("USB CDC Ethernet devices");
index 9c26c6390d69a72abffbf47dc91d9aea96ec1ba0,497db19f8cf8159888668382795dd1ec9afc4376..45a981fde43fc278cc1d418fc9d2fb7ba19b9060
@@@ -144,11 -144,10 +144,11 @@@ static int vl600_rx_fixup(struct usbne
        }
  
        frame = (struct vl600_frame_hdr *) buf->data;
 -      /* NOTE: Should check that frame->magic == 0x53544448?
 -       * Otherwise if we receive garbage at the beginning of the frame
 -       * we may end up allocating a huge buffer and saving all the
 -       * future incoming data into it.  */
 +      /* Yes, check that frame->magic == 0x53544448 (or 0x44544d48),
 +       * otherwise we may run out of memory w/a bad packet */
 +      if (ntohl(frame->magic) != 0x53544448 &&
 +                      ntohl(frame->magic) != 0x44544d48)
 +              goto error;
  
        if (buf->len < sizeof(*frame) ||
                        buf->len != le32_to_cpup(&frame->len)) {
@@@ -297,11 -296,6 +297,11 @@@ encapsulate
         * overwrite the remaining fields.
         */
        packet = (struct vl600_pkt_hdr *) skb->data;
 +      /* The VL600 wants IPv6 packets to have an IPv4 ethertype
 +       * Since this modem only supports IPv4 and IPv6, just set all
 +       * frames to 0x0800 (ETH_P_IP)
 +       */
 +      packet->h_proto = htons(ETH_P_IP);
        memset(&packet->dummy, 0, sizeof(packet->dummy));
        packet->len = cpu_to_le32(orig_len);
  
        if (skb->len < full_len) /* Pad */
                skb_put(skb, full_len - skb->len);
  
 -      /* The VL600 wants IPv6 packets to have an IPv4 ethertype
 -       * Check if this is an IPv6 packet, and set the ethertype
 -       * to 0x800
 -       */
 -      if ((skb->data[sizeof(struct vl600_pkt_hdr *) + 0x22] & 0xf0) == 0x60) {
 -              skb->data[sizeof(struct vl600_pkt_hdr *) + 0x20] = 0x08;
 -              skb->data[sizeof(struct vl600_pkt_hdr *) + 0x21] = 0;
 -      }
 -
        return skb;
  }
  
  static const struct driver_info       vl600_info = {
        .description    = "LG VL600 modem",
 -      .flags          = FLAG_ETHER | FLAG_RX_ASSEMBLE,
 +      .flags          = FLAG_RX_ASSEMBLE | FLAG_WWAN,
        .bind           = vl600_bind,
        .unbind         = vl600_unbind,
        .status         = usbnet_cdc_status,
@@@ -346,17 -349,7 +346,7 @@@ static struct usb_driver lg_vl600_drive
        .resume         = usbnet_resume,
  };
  
- static int __init vl600_init(void)
- {
-       return usb_register(&lg_vl600_driver);
- }
- module_init(vl600_init);
- static void __exit vl600_exit(void)
- {
-       usb_deregister(&lg_vl600_driver);
- }
- module_exit(vl600_exit);
+ module_usb_driver(lg_vl600_driver);
  
  MODULE_AUTHOR("Anrzej Zaborowski");
  MODULE_DESCRIPTION("LG-VL600 modem's ethernet link");
index a5b9b12ef268134fef1e978d8e19ce5468c16135,9741b24f0668472a7b750648722c7bd04aa1a323..e85840ee36e0d566cf7e8a9569246172a279052b
@@@ -51,7 -51,6 +51,7 @@@
  #define USB_VENDOR_ID_SMSC            (0x0424)
  #define USB_PRODUCT_ID_LAN7500                (0x7500)
  #define USB_PRODUCT_ID_LAN7505                (0x7505)
 +#define RXW_PADDING                   2
  
  #define check_warn(ret, fmt, args...) \
        ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); })
@@@ -1089,13 -1088,13 +1089,13 @@@ static int smsc75xx_rx_fixup(struct usb
  
                memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b));
                le32_to_cpus(&rx_cmd_b);
 -              skb_pull(skb, 4 + NET_IP_ALIGN);
 +              skb_pull(skb, 4 + RXW_PADDING);
  
                packet = skb->data;
  
                /* get the packet length */
 -              size = (rx_cmd_a & RX_CMD_A_LEN) - NET_IP_ALIGN;
 -              align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4;
 +              size = (rx_cmd_a & RX_CMD_A_LEN) - RXW_PADDING;
 +              align_count = (4 - ((size + RXW_PADDING) % 4)) % 4;
  
                if (unlikely(rx_cmd_a & RX_CMD_A_RED)) {
                        netif_dbg(dev, rx_err, dev->net,
@@@ -1237,17 -1236,7 +1237,7 @@@ static struct usb_driver smsc75xx_drive
        .disconnect     = usbnet_disconnect,
  };
  
- static int __init smsc75xx_init(void)
- {
-       return usb_register(&smsc75xx_driver);
- }
- module_init(smsc75xx_init);
- static void __exit smsc75xx_exit(void)
- {
-       usb_deregister(&smsc75xx_driver);
- }
- module_exit(smsc75xx_exit);
+ module_usb_driver(smsc75xx_driver);
  
  MODULE_AUTHOR("Nancy Lin");
  MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>");
index 377876315b8d4a9bcdcc91b228b14bed45bef943,78550a7f689c2a74d808deaab758b1a956e47b1b..9ea4ecb3d9c8198109e38378b402b6ad61a4f1bd
@@@ -919,7 -919,6 +919,7 @@@ static struct usb_device_id rt2800usb_d
        { USB_DEVICE(0x050d, 0x935b) },
        /* Buffalo */
        { USB_DEVICE(0x0411, 0x00e8) },
 +      { USB_DEVICE(0x0411, 0x0158) },
        { USB_DEVICE(0x0411, 0x016f) },
        { USB_DEVICE(0x0411, 0x01a2) },
        /* Corega */
@@@ -1234,15 -1233,4 +1234,4 @@@ static struct usb_driver rt2800usb_driv
        .resume         = rt2x00usb_resume,
  };
  
- static int __init rt2800usb_init(void)
- {
-       return usb_register(&rt2800usb_driver);
- }
- static void __exit rt2800usb_exit(void)
- {
-       usb_deregister(&rt2800usb_driver);
- }
- module_init(rt2800usb_init);
- module_exit(rt2800usb_exit);
+ module_usb_driver(rt2800usb_driver);
index 9fbe742343c6cb6d023706bd7d5bd8170191d49e,5929f49d0b434a89ff70b3de1f30f46816d8ca7b..b0a1687ca94263d99b1e1bc3c45874300dd67f3c
@@@ -1762,9 -1762,10 +1762,9 @@@ static int ms_scsi_write(struct us_dat
                result = ene_send_scsi_cmd(us, FDIR_WRITE, scsi_sglist(srb), 1);
        } else {
                void *buf;
 -              int offset;
 +              int offset = 0;
                u16 PhyBlockAddr;
                u8 PageNum;
 -              u32 result;
                u16 len, oldphy, newphy;
  
                buf = kmalloc(blenByte, GFP_KERNEL);
@@@ -2409,15 -2410,4 +2409,4 @@@ static struct usb_driver ene_ub6250_dri
        .soft_unbind =  1,
  };
  
- static int __init ene_ub6250_init(void)
- {
-       return usb_register(&ene_ub6250_driver);
- }
- static void __exit ene_ub6250_exit(void)
- {
-       usb_deregister(&ene_ub6250_driver);
- }
- module_init(ene_ub6250_init);
- module_exit(ene_ub6250_exit);
+ module_usb_driver(ene_ub6250_driver);
diff --combined include/linux/device.h
index 3136ede5a1e1bb8434a0e2d52840f84de39647de,acf505e4fe94b3bb9a3dbc5ecdaa27d5492b4be9..96acef8dd916a1d951ffd86e4ed3d33a8e0c7898
@@@ -53,6 -53,8 +53,8 @@@ extern void bus_remove_file(struct bus_
   * struct bus_type - The bus type of the device
   *
   * @name:     The name of the bus.
+  * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
+  * @dev_root: Default device to use as the parent.
   * @bus_attrs:        Default attributes of the bus.
   * @dev_attrs:        Default attributes of the devices on the bus.
   * @drv_attrs:        Default attributes of the device drivers on the bus.
@@@ -69,7 -71,7 +71,7 @@@
   * @resume:   Called to bring a device on this bus out of sleep mode.
   * @pm:               Power management operations of this bus, callback the specific
   *            device driver's pm-ops.
 - * @iommu_ops   IOMMU specific operations for this bus, used to attach IOMMU
 + * @iommu_ops:  IOMMU specific operations for this bus, used to attach IOMMU
   *              driver implementations to a bus and allow the driver to do
   *              bus-specific setup
   * @p:                The private data of the driver core, only the driver core can
@@@ -86,6 -88,8 +88,8 @@@
   */
  struct bus_type {
        const char              *name;
+       const char              *dev_name;
+       struct device           *dev_root;
        struct bus_attribute    *bus_attrs;
        struct device_attribute *dev_attrs;
        struct driver_attribute *drv_attrs;
        struct subsys_private *p;
  };
  
- extern int __must_check bus_register(struct bus_type *bus);
+ /* This is a #define to keep the compiler from merging different
+  * instances of the __key variable */
+ #define bus_register(subsys)                  \
+ ({                                            \
+       static struct lock_class_key __key;     \
+       __bus_register(subsys, &__key); \
+ })
+ extern int __must_check __bus_register(struct bus_type *bus,
+                                      struct lock_class_key *key);
  extern void bus_unregister(struct bus_type *bus);
  
  extern int __must_check bus_rescan_devices(struct bus_type *bus);
  
  /* iterator helpers for buses */
+ struct subsys_dev_iter {
+       struct klist_iter               ki;
+       const struct device_type        *type;
+ };
+ void subsys_dev_iter_init(struct subsys_dev_iter *iter,
+                        struct bus_type *subsys,
+                        struct device *start,
+                        const struct device_type *type);
+ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
+ void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
  
  int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
                     int (*fn)(struct device *dev, void *data));
@@@ -121,10 -143,10 +143,10 @@@ struct device *bus_find_device(struct b
  struct device *bus_find_device_by_name(struct bus_type *bus,
                                       struct device *start,
                                       const char *name);
+ struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
+                                       struct device *hint);
  int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
                     void *data, int (*fn)(struct device_driver *, void *));
  void bus_sort_breadthfirst(struct bus_type *bus,
                           int (*compare)(const struct device *a,
                                          const struct device *b));
@@@ -255,6 -277,33 +277,33 @@@ struct device *driver_find_device(struc
                                  struct device *start, void *data,
                                  int (*match)(struct device *dev, void *data));
  
+ /**
+  * struct subsys_interface - interfaces to device functions
+  * @name        name of the device function
+  * @subsystem   subsytem of the devices to attach to
+  * @node        the list of functions registered at the subsystem
+  * @add         device hookup to device function handler
+  * @remove      device hookup to device function handler
+  *
+  * Simple interfaces attached to a subsystem. Multiple interfaces can
+  * attach to a subsystem and its devices. Unlike drivers, they do not
+  * exclusively claim or control devices. Interfaces usually represent
+  * a specific functionality of a subsystem/class of devices.
+  */
+ struct subsys_interface {
+       const char *name;
+       struct bus_type *subsys;
+       struct list_head node;
+       int (*add_dev)(struct device *dev, struct subsys_interface *sif);
+       int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
+ };
+ int subsys_interface_register(struct subsys_interface *sif);
+ void subsys_interface_unregister(struct subsys_interface *sif);
+ int subsys_system_register(struct bus_type *subsys,
+                          const struct attribute_group **groups);
  /**
   * struct class - device classes
   * @name:     Name of the class.
@@@ -438,11 -487,31 +487,31 @@@ struct device_attribute 
                         const char *buf, size_t count);
  };
  
- #define DEVICE_ATTR(_name, _mode, _show, _store) \
- struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+ struct dev_ext_attribute {
+       struct device_attribute attr;
+       void *var;
+ };
+ ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
+                         char *buf);
+ ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
+                          const char *buf, size_t count);
+ ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
+                       char *buf);
+ ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
+                        const char *buf, size_t count);
  
- extern int __must_check device_create_file(struct device *device,
-                                       const struct device_attribute *entry);
+ #define DEVICE_ATTR(_name, _mode, _show, _store) \
+       struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+ #define DEVICE_ULONG_ATTR(_name, _mode, _var) \
+       struct dev_ext_attribute dev_attr_##_name = \
+               { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
+ #define DEVICE_INT_ATTR(_name, _mode, _var) \
+       struct dev_ext_attribute dev_attr_##_name = \
+               { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
+ extern int device_create_file(struct device *device,
+                             const struct device_attribute *entry);
  extern void device_remove_file(struct device *dev,
                               const struct device_attribute *attr);
  extern int __must_check device_create_bin_file(struct device *dev,
@@@ -490,6 -559,9 +559,9 @@@ extern int devres_release_group(struct 
  extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
  extern void devm_kfree(struct device *dev, void *p);
  
+ void __iomem *devm_request_and_ioremap(struct device *dev,
+                       struct resource *res);
  struct device_dma_parameters {
        /*
         * a low level driver may set these to teach IOMMU code about
@@@ -600,6 -672,7 +672,7 @@@ struct device 
        struct device_node      *of_node; /* associated device tree node */
  
        dev_t                   devt;   /* dev_t, creates the sysfs "dev" */
+       u32                     id;     /* device instance */
  
        spinlock_t              devres_lock;
        struct list_head        devres_head;
@@@ -682,11 -755,6 +755,11 @@@ static inline bool device_async_suspend
        return !!dev->power.async_suspend;
  }
  
 +static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
 +{
 +      dev->power.ignore_children = enable;
 +}
 +
  static inline void device_lock(struct device *dev)
  {
        mutex_lock(&dev->mutex);
@@@ -924,4 -992,25 +997,25 @@@ extern long sysfs_deprecated
  #define sysfs_deprecated 0
  #endif
  
+ /**
+  * module_driver() - Helper macro for drivers that don't do anything
+  * special in module init/exit. This eliminates a lot of boilerplate.
+  * Each module may only use this macro once, and calling it replaces
+  * module_init() and module_exit().
+  *
+  * Use this macro to construct bus specific macros for registering
+  * drivers, and do not use it on its own.
+  */
+ #define module_driver(__driver, __register, __unregister) \
+ static int __init __driver##_init(void) \
+ { \
+       return __register(&(__driver)); \
+ } \
+ module_init(__driver##_init); \
+ static void __exit __driver##_exit(void) \
+ { \
+       __unregister(&(__driver)); \
+ } \
+ module_exit(__driver##_exit);
  #endif /* _DEVICE_H_ */
diff --combined include/linux/i2c.h
index 07d103a06d64a04e17e06a2b9011f773ef60d8f1,7e92854fe9cc1a713351962a2516edfa42ab1d8f..8e25a9167f1303f3d07e63a26beb93f5d2987e98
@@@ -432,6 -432,9 +432,6 @@@ void i2c_unlock_adapter(struct i2c_adap
  /* Internal numbers to terminate lists */
  #define I2C_CLIENT_END                0xfffeU
  
 -/* The numbers to use to set I2C bus address */
 -#define ANY_I2C_BUS           0xffff
 -
  /* Construct an I2C_CLIENT_END-terminated array of i2c addresses */
  #define I2C_ADDRS(addr, addrs...) \
        ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
@@@ -482,6 -485,19 +482,19 @@@ static inline int i2c_adapter_id(struc
  {
        return adap->nr;
  }
+ /**
+  * module_i2c_driver() - Helper macro for registering a I2C driver
+  * @__i2c_driver: i2c_driver struct
+  *
+  * Helper macro for I2C drivers which do not do anything special in module
+  * init/exit. This eliminates a lot of boilerplate. Each module may only
+  * use this macro once, and calling it replaces module_init() and module_exit()
+  */
+ #define module_i2c_driver(__i2c_driver) \
+       module_driver(__i2c_driver, i2c_add_driver, \
+                       i2c_del_driver)
  #endif /* I2C */
  #endif /* __KERNEL__ */
  
diff --combined kernel/sched.c
index d6b149ccf925c320841e8a42f31fd23b6ee64dc6,5307726464431c3b8fb4c663aa45d97c76fcefa7..a7f381a78469b9bf6ba5ab1b1061254ab1fafc3e
@@@ -71,7 -71,6 +71,7 @@@
  #include <linux/ctype.h>
  #include <linux/ftrace.h>
  #include <linux/slab.h>
 +#include <linux/init_task.h>
  
  #include <asm/tlb.h>
  #include <asm/irq_regs.h>
@@@ -4811,9 -4810,6 +4811,9 @@@ EXPORT_SYMBOL(wait_for_completion)
   * This waits for either a completion of a specific task to be signaled or for a
   * specified timeout to expire. The timeout is in jiffies. It is not
   * interruptible.
 + *
 + * The return value is 0 if timed out, and positive (at least 1, or number of
 + * jiffies left till timeout) if completed.
   */
  unsigned long __sched
  wait_for_completion_timeout(struct completion *x, unsigned long timeout)
@@@ -4828,8 -4824,6 +4828,8 @@@ EXPORT_SYMBOL(wait_for_completion_timeo
   *
   * This waits for completion of a specific task to be signaled. It is
   * interruptible.
 + *
 + * The return value is -ERESTARTSYS if interrupted, 0 if completed.
   */
  int __sched wait_for_completion_interruptible(struct completion *x)
  {
@@@ -4847,9 -4841,6 +4847,9 @@@ EXPORT_SYMBOL(wait_for_completion_inter
   *
   * This waits for either a completion of a specific task to be signaled or for a
   * specified timeout to expire. It is interruptible. The timeout is in jiffies.
 + *
 + * The return value is -ERESTARTSYS if interrupted, 0 if timed out,
 + * positive (at least 1, or number of jiffies left till timeout) if completed.
   */
  long __sched
  wait_for_completion_interruptible_timeout(struct completion *x,
@@@ -4865,8 -4856,6 +4865,8 @@@ EXPORT_SYMBOL(wait_for_completion_inter
   *
   * This waits to be signaled for completion of a specific task. It can be
   * interrupted by a kill signal.
 + *
 + * The return value is -ERESTARTSYS if interrupted, 0 if completed.
   */
  int __sched wait_for_completion_killable(struct completion *x)
  {
@@@ -4885,9 -4874,6 +4885,9 @@@ EXPORT_SYMBOL(wait_for_completion_killa
   * This waits for either a completion of a specific task to be
   * signaled or for a specified timeout to expire. It can be
   * interrupted by a kill signal. The timeout is in jiffies.
 + *
 + * The return value is -ERESTARTSYS if interrupted, 0 if timed out,
 + * positive (at least 1, or number of jiffies left till timeout) if completed.
   */
  long __sched
  wait_for_completion_killable_timeout(struct completion *x,
@@@ -6113,9 -6099,6 +6113,9 @@@ void __cpuinit init_idle(struct task_st
         */
        idle->sched_class = &idle_sched_class;
        ftrace_graph_init_idle_task(idle, cpu);
 +#if defined(CONFIG_SMP)
 +      sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
 +#endif
  }
  
  /*
@@@ -7940,54 -7923,52 +7940,52 @@@ static ssize_t sched_power_savings_stor
  }
  
  #ifdef CONFIG_SCHED_MC
- static ssize_t sched_mc_power_savings_show(struct sysdev_class *class,
-                                          struct sysdev_class_attribute *attr,
-                                          char *page)
+ static ssize_t sched_mc_power_savings_show(struct device *dev,
+                                          struct device_attribute *attr,
+                                          char *buf)
  {
-       return sprintf(page, "%u\n", sched_mc_power_savings);
+       return sprintf(buf, "%u\n", sched_mc_power_savings);
  }
- static ssize_t sched_mc_power_savings_store(struct sysdev_class *class,
-                                           struct sysdev_class_attribute *attr,
+ static ssize_t sched_mc_power_savings_store(struct device *dev,
+                                           struct device_attribute *attr,
                                            const char *buf, size_t count)
  {
        return sched_power_savings_store(buf, count, 0);
  }
- static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644,
-                        sched_mc_power_savings_show,
-                        sched_mc_power_savings_store);
+ static DEVICE_ATTR(sched_mc_power_savings, 0644,
+                  sched_mc_power_savings_show,
+                  sched_mc_power_savings_store);
  #endif
  
  #ifdef CONFIG_SCHED_SMT
- static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev,
-                                           struct sysdev_class_attribute *attr,
-                                           char *page)
+ static ssize_t sched_smt_power_savings_show(struct device *dev,
+                                           struct device_attribute *attr,
+                                           char *buf)
  {
-       return sprintf(page, "%u\n", sched_smt_power_savings);
+       return sprintf(buf, "%u\n", sched_smt_power_savings);
  }
- static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev,
-                                            struct sysdev_class_attribute *attr,
+ static ssize_t sched_smt_power_savings_store(struct device *dev,
+                                           struct device_attribute *attr,
                                             const char *buf, size_t count)
  {
        return sched_power_savings_store(buf, count, 1);
  }
- static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644,
+ static DEVICE_ATTR(sched_smt_power_savings, 0644,
                   sched_smt_power_savings_show,
                   sched_smt_power_savings_store);
  #endif
  
- int __init sched_create_sysfs_power_savings_entries(struct sysdev_class *cls)
+ int __init sched_create_sysfs_power_savings_entries(struct device *dev)
  {
        int err = 0;
  
  #ifdef CONFIG_SCHED_SMT
        if (smt_capable())
-               err = sysfs_create_file(&cls->kset.kobj,
-                                       &attr_sched_smt_power_savings.attr);
+               err = device_create_file(dev, &dev_attr_sched_smt_power_savings);
  #endif
  #ifdef CONFIG_SCHED_MC
        if (!err && mc_capable())
-               err = sysfs_create_file(&cls->kset.kobj,
-                                       &attr_sched_mc_power_savings.attr);
+               err = device_create_file(dev, &dev_attr_sched_mc_power_savings);
  #endif
        return err;
  }
index d3ad022136e56b97f7b51ec1a3fa018889a4944b,3f5c8512c033d2348f9a354fe6d312d8e1206354..a45ca167ab242070577b874f16fe004735b8de07
@@@ -23,8 -23,8 +23,8 @@@
   *   o Allow clocksource drivers to be unregistered
   */
  
+ #include <linux/device.h>
  #include <linux/clocksource.h>
- #include <linux/sysdev.h>
  #include <linux/init.h>
  #include <linux/module.h>
  #include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */
@@@ -491,22 -491,6 +491,22 @@@ void clocksource_touch_watchdog(void
        clocksource_resume_watchdog();
  }
  
 +/**
 + * clocksource_max_adjustment- Returns max adjustment amount
 + * @cs:         Pointer to clocksource
 + *
 + */
 +static u32 clocksource_max_adjustment(struct clocksource *cs)
 +{
 +      u64 ret;
 +      /*
 +       * We won't try to correct for more then 11% adjustments (110,000 ppm),
 +       */
 +      ret = (u64)cs->mult * 11;
 +      do_div(ret,100);
 +      return (u32)ret;
 +}
 +
  /**
   * clocksource_max_deferment - Returns max time the clocksource can be deferred
   * @cs:         Pointer to clocksource
@@@ -519,28 -503,25 +519,28 @@@ static u64 clocksource_max_deferment(st
        /*
         * Calculate the maximum number of cycles that we can pass to the
         * cyc2ns function without overflowing a 64-bit signed result. The
 -       * maximum number of cycles is equal to ULLONG_MAX/cs->mult which
 -       * is equivalent to the below.
 -       * max_cycles < (2^63)/cs->mult
 -       * max_cycles < 2^(log2((2^63)/cs->mult))
 -       * max_cycles < 2^(log2(2^63) - log2(cs->mult))
 -       * max_cycles < 2^(63 - log2(cs->mult))
 -       * max_cycles < 1 << (63 - log2(cs->mult))
 +       * maximum number of cycles is equal to ULLONG_MAX/(cs->mult+cs->maxadj)
 +       * which is equivalent to the below.
 +       * max_cycles < (2^63)/(cs->mult + cs->maxadj)
 +       * max_cycles < 2^(log2((2^63)/(cs->mult + cs->maxadj)))
 +       * max_cycles < 2^(log2(2^63) - log2(cs->mult + cs->maxadj))
 +       * max_cycles < 2^(63 - log2(cs->mult + cs->maxadj))
 +       * max_cycles < 1 << (63 - log2(cs->mult + cs->maxadj))
         * Please note that we add 1 to the result of the log2 to account for
         * any rounding errors, ensure the above inequality is satisfied and
         * no overflow will occur.
         */
 -      max_cycles = 1ULL << (63 - (ilog2(cs->mult) + 1));
 +      max_cycles = 1ULL << (63 - (ilog2(cs->mult + cs->maxadj) + 1));
  
        /*
         * The actual maximum number of cycles we can defer the clocksource is
         * determined by the minimum of max_cycles and cs->mask.
 +       * Note: Here we subtract the maxadj to make sure we don't sleep for
 +       * too long if there's a large negative adjustment.
         */
        max_cycles = min_t(u64, max_cycles, (u64) cs->mask);
 -      max_nsecs = clocksource_cyc2ns(max_cycles, cs->mult, cs->shift);
 +      max_nsecs = clocksource_cyc2ns(max_cycles, cs->mult - cs->maxadj,
 +                                      cs->shift);
  
        /*
         * To ensure that the clocksource does not wrap whilst we are idle,
         * note a margin of 12.5% is used because this can be computed with
         * a shift, versus say 10% which would require division.
         */
 -      return max_nsecs - (max_nsecs >> 5);
 +      return max_nsecs - (max_nsecs >> 3);
  }
  
  #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
@@@ -647,7 -628,7 +647,7 @@@ static void clocksource_enqueue(struct 
  
  /**
   * __clocksource_updatefreq_scale - Used update clocksource with new freq
 - * @t:                clocksource to be registered
 + * @cs:               clocksource to be registered
   * @scale:    Scale factor multiplied against freq to get clocksource hz
   * @freq:     clocksource frequency (cycles per second) divided by scale
   *
  void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq)
  {
        u64 sec;
 -
        /*
         * Calc the maximum number of seconds which we can run before
         * wrapping around. For clocksources which have a mask > 32bit
         * ~ 0.06ppm granularity for NTP. We apply the same 12.5%
         * margin as we do in clocksource_max_deferment()
         */
 -      sec = (cs->mask - (cs->mask >> 5));
 +      sec = (cs->mask - (cs->mask >> 3));
        do_div(sec, freq);
        do_div(sec, scale);
        if (!sec)
  
        clocks_calc_mult_shift(&cs->mult, &cs->shift, freq,
                               NSEC_PER_SEC / scale, sec * scale);
 +
 +      /*
 +       * for clocksources that have large mults, to avoid overflow.
 +       * Since mult may be adjusted by ntp, add an safety extra margin
 +       *
 +       */
 +      cs->maxadj = clocksource_max_adjustment(cs);
 +      while ((cs->mult + cs->maxadj < cs->mult)
 +              || (cs->mult - cs->maxadj > cs->mult)) {
 +              cs->mult >>= 1;
 +              cs->shift--;
 +              cs->maxadj = clocksource_max_adjustment(cs);
 +      }
 +
        cs->max_idle_ns = clocksource_max_deferment(cs);
  }
  EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
  
  /**
   * __clocksource_register_scale - Used to install new clocksources
 - * @t:                clocksource to be registered
 + * @cs:               clocksource to be registered
   * @scale:    Scale factor multiplied against freq to get clocksource hz
   * @freq:     clocksource frequency (cycles per second) divided by scale
   *
@@@ -727,18 -695,12 +727,18 @@@ EXPORT_SYMBOL_GPL(__clocksource_registe
  
  /**
   * clocksource_register - Used to install new clocksources
 - * @t:                clocksource to be registered
 + * @cs:               clocksource to be registered
   *
   * Returns -EBUSY if registration fails, zero otherwise.
   */
  int clocksource_register(struct clocksource *cs)
  {
 +      /* calculate max adjustment for given mult/shift */
 +      cs->maxadj = clocksource_max_adjustment(cs);
 +      WARN_ONCE(cs->mult + cs->maxadj < cs->mult,
 +              "Clocksource %s might overflow on 11%% adjustment\n",
 +              cs->name);
 +
        /* calculate max idle time permitted for this clocksource */
        cs->max_idle_ns = clocksource_max_deferment(cs);
  
@@@ -761,8 -723,6 +761,8 @@@ static void __clocksource_change_rating
  
  /**
   * clocksource_change_rating - Change the rating of a registered clocksource
 + * @cs:               clocksource to be changed
 + * @rating:   new rating
   */
  void clocksource_change_rating(struct clocksource *cs, int rating)
  {
@@@ -774,7 -734,6 +774,7 @@@ EXPORT_SYMBOL(clocksource_change_rating
  
  /**
   * clocksource_unregister - remove a registered clocksource
 + * @cs:       clocksource to be unregistered
   */
  void clocksource_unregister(struct clocksource *cs)
  {
@@@ -790,14 -749,13 +790,14 @@@ EXPORT_SYMBOL(clocksource_unregister)
  /**
   * sysfs_show_current_clocksources - sysfs interface for current clocksource
   * @dev:      unused
 + * @attr:     unused
   * @buf:      char buffer to be filled with clocksource list
   *
   * Provides sysfs interface for listing current clocksource.
   */
  static ssize_t
- sysfs_show_current_clocksources(struct sys_device *dev,
-                               struct sysdev_attribute *attr, char *buf)
+ sysfs_show_current_clocksources(struct device *dev,
+                               struct device_attribute *attr, char *buf)
  {
        ssize_t count = 0;
  
  /**
   * sysfs_override_clocksource - interface for manually overriding clocksource
   * @dev:      unused
 + * @attr:     unused
   * @buf:      name of override clocksource
   * @count:    length of buffer
   *
   * Takes input from sysfs interface for manually overriding the default
   * clocksource selection.
   */
- static ssize_t sysfs_override_clocksource(struct sys_device *dev,
-                                         struct sysdev_attribute *attr,
+ static ssize_t sysfs_override_clocksource(struct device *dev,
+                                         struct device_attribute *attr,
                                          const char *buf, size_t count)
  {
        size_t ret = count;
  /**
   * sysfs_show_available_clocksources - sysfs interface for listing clocksource
   * @dev:      unused
 + * @attr:     unused
   * @buf:      char buffer to be filled with clocksource list
   *
   * Provides sysfs interface for listing registered clocksources
   */
  static ssize_t
- sysfs_show_available_clocksources(struct sys_device *dev,
-                                 struct sysdev_attribute *attr,
+ sysfs_show_available_clocksources(struct device *dev,
+                                 struct device_attribute *attr,
                                  char *buf)
  {
        struct clocksource *src;
  /*
   * Sysfs setup bits:
   */
- static SYSDEV_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources,
+ static DEVICE_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources,
                   sysfs_override_clocksource);
  
- static SYSDEV_ATTR(available_clocksource, 0444,
+ static DEVICE_ATTR(available_clocksource, 0444,
                   sysfs_show_available_clocksources, NULL);
  
- static struct sysdev_class clocksource_sysclass = {
+ static struct bus_type clocksource_subsys = {
        .name = "clocksource",
+       .dev_name = "clocksource",
  };
  
- static struct sys_device device_clocksource = {
+ static struct device device_clocksource = {
        .id     = 0,
-       .cls    = &clocksource_sysclass,
+       .bus    = &clocksource_subsys,
  };
  
  static int __init init_clocksource_sysfs(void)
  {
-       int error = sysdev_class_register(&clocksource_sysclass);
+       int error = subsys_system_register(&clocksource_subsys, NULL);
  
        if (!error)
-               error = sysdev_register(&device_clocksource);
+               error = device_register(&device_clocksource);
        if (!error)
-               error = sysdev_create_file(
+               error = device_create_file(
                                &device_clocksource,
-                               &attr_current_clocksource);
+                               &dev_attr_current_clocksource);
        if (!error)
-               error = sysdev_create_file(
+               error = device_create_file(
                                &device_clocksource,
-                               &attr_available_clocksource);
+                               &dev_attr_available_clocksource);
        return error;
  }
  
diff --combined mm/hugetlb.c
index 2316840b337a37447d2d8cbe294f53df71e53575,ad713e2d61bc8ee87e272034eee7b8d36419b29f..7acd12503f734bfcaff2c4fed244e594952962ea
@@@ -576,7 -576,6 +576,7 @@@ static void prep_compound_gigantic_page
        __SetPageHead(page);
        for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
                __SetPageTail(p);
 +              set_page_count(p, 0);
                p->first_page = page;
        }
  }
@@@ -901,6 -900,7 +901,6 @@@ retry
        h->resv_huge_pages += delta;
        ret = 0;
  
 -      spin_unlock(&hugetlb_lock);
        /* Free the needed pages to the hugetlb pool */
        list_for_each_entry_safe(page, tmp, &surplus_list, lru) {
                if ((--needed) < 0)
                VM_BUG_ON(page_count(page));
                enqueue_huge_page(h, page);
        }
 +      spin_unlock(&hugetlb_lock);
  
        /* Free unnecessary surplus pages to the buddy allocator */
  free:
@@@ -1592,9 -1591,9 +1592,9 @@@ static void __init hugetlb_sysfs_init(v
  
  /*
   * node_hstate/s - associate per node hstate attributes, via their kobjects,
-  * with node sysdevs in node_devices[] using a parallel array.  The array
-  * index of a node sysdev or _hstate == node id.
-  * This is here to avoid any static dependency of the node sysdev driver, in
+  * with node devices in node_devices[] using a parallel array.  The array
+  * index of a node device or _hstate == node id.
+  * This is here to avoid any static dependency of the node device driver, in
   * the base kernel, on the hugetlb module.
   */
  struct node_hstate {
  struct node_hstate node_hstates[MAX_NUMNODES];
  
  /*
-  * A subset of global hstate attributes for node sysdevs
+  * A subset of global hstate attributes for node devices
   */
  static struct attribute *per_node_hstate_attrs[] = {
        &nr_hugepages_attr.attr,
@@@ -1618,7 -1617,7 +1618,7 @@@ static struct attribute_group per_node_
  };
  
  /*
-  * kobj_to_node_hstate - lookup global hstate for node sysdev hstate attr kobj.
+  * kobj_to_node_hstate - lookup global hstate for node device hstate attr kobj.
   * Returns node id via non-NULL nidp.
   */
  static struct hstate *kobj_to_node_hstate(struct kobject *kobj, int *nidp)
  }
  
  /*
-  * Unregister hstate attributes from a single node sysdev.
+  * Unregister hstate attributes from a single node device.
   * No-op if no hstate attributes attached.
   */
  void hugetlb_unregister_node(struct node *node)
  {
        struct hstate *h;
-       struct node_hstate *nhs = &node_hstates[node->sysdev.id];
+       struct node_hstate *nhs = &node_hstates[node->dev.id];
  
        if (!nhs->hugepages_kobj)
                return;         /* no hstate attributes */
  }
  
  /*
-  * hugetlb module exit:  unregister hstate attributes from node sysdevs
+  * hugetlb module exit:  unregister hstate attributes from node devices
   * that have them.
   */
  static void hugetlb_unregister_all_nodes(void)
        int nid;
  
        /*
-        * disable node sysdev registrations.
+        * disable node device registrations.
         */
        register_hugetlbfs_with_node(NULL, NULL);
  
  }
  
  /*
-  * Register hstate attributes for a single node sysdev.
+  * Register hstate attributes for a single node device.
   * No-op if attributes already registered.
   */
  void hugetlb_register_node(struct node *node)
  {
        struct hstate *h;
-       struct node_hstate *nhs = &node_hstates[node->sysdev.id];
+       struct node_hstate *nhs = &node_hstates[node->dev.id];
        int err;
  
        if (nhs->hugepages_kobj)
                return;         /* already allocated */
  
        nhs->hugepages_kobj = kobject_create_and_add("hugepages",
-                                                       &node->sysdev.kobj);
+                                                       &node->dev.kobj);
        if (!nhs->hugepages_kobj)
                return;
  
                if (err) {
                        printk(KERN_ERR "Hugetlb: Unable to add hstate %s"
                                        " for node %d\n",
-                                               h->name, node->sysdev.id);
+                                               h->name, node->dev.id);
                        hugetlb_unregister_node(node);
                        break;
                }
  
  /*
   * hugetlb init time:  register hstate attributes for all registered node
-  * sysdevs of nodes that have memory.  All on-line nodes should have
-  * registered their associated sysdev by this time.
+  * devices of nodes that have memory.  All on-line nodes should have
+  * registered their associated device by this time.
   */
  static void hugetlb_register_all_nodes(void)
  {
  
        for_each_node_state(nid, N_HIGH_MEMORY) {
                struct node *node = &node_devices[nid];
-               if (node->sysdev.id == nid)
+               if (node->dev.id == nid)
                        hugetlb_register_node(node);
        }
  
        /*
-        * Let the node sysdev driver know we're here so it can
+        * Let the node device driver know we're here so it can
         * [un]register hstate attributes on node hotplug.
         */
        register_hugetlbfs_with_node(hugetlb_register_node,
@@@ -2423,8 -2422,6 +2423,8 @@@ retry_avoidcopy
         * anon_vma prepared.
         */
        if (unlikely(anon_vma_prepare(vma))) {
 +              page_cache_release(new_page);
 +              page_cache_release(old_page);
                /* Caller expects lock to be held */
                spin_lock(&mm->page_table_lock);
                return VM_FAULT_OOM;
diff --combined mm/vmscan.c
index f54a05b7a61d9eb658562b191996beb9d4cea397,2b4189d759e4b11db845cdc582d316f0f6c95592..11adc890ce30bb5f09c3a53765ce0b57474a893a
@@@ -183,7 -183,7 +183,7 @@@ static unsigned long zone_nr_lru_pages(
   */
  void register_shrinker(struct shrinker *shrinker)
  {
 -      shrinker->nr = 0;
 +      atomic_long_set(&shrinker->nr_in_batch, 0);
        down_write(&shrinker_rwsem);
        list_add_tail(&shrinker->list, &shrinker_list);
        up_write(&shrinker_rwsem);
@@@ -247,26 -247,25 +247,26 @@@ unsigned long shrink_slab(struct shrink
  
        list_for_each_entry(shrinker, &shrinker_list, list) {
                unsigned long long delta;
 -              unsigned long total_scan;
 -              unsigned long max_pass;
 +              long total_scan;
 +              long max_pass;
                int shrink_ret = 0;
                long nr;
                long new_nr;
                long batch_size = shrinker->batch ? shrinker->batch
                                                  : SHRINK_BATCH;
  
 +              max_pass = do_shrinker_shrink(shrinker, shrink, 0);
 +              if (max_pass <= 0)
 +                      continue;
 +
                /*
                 * copy the current shrinker scan count into a local variable
                 * and zero it so that other concurrent shrinker invocations
                 * don't also do this scanning work.
                 */
 -              do {
 -                      nr = shrinker->nr;
 -              } while (cmpxchg(&shrinker->nr, nr, 0) != nr);
 +              nr = atomic_long_xchg(&shrinker->nr_in_batch, 0);
  
                total_scan = nr;
 -              max_pass = do_shrinker_shrink(shrinker, shrink, 0);
                delta = (4 * nr_pages_scanned) / shrinker->seeks;
                delta *= max_pass;
                do_div(delta, lru_pages + 1);
                 * manner that handles concurrent updates. If we exhausted the
                 * scan, there is no need to do an update.
                 */
 -              do {
 -                      nr = shrinker->nr;
 -                      new_nr = total_scan + nr;
 -                      if (total_scan <= 0)
 -                              break;
 -              } while (cmpxchg(&shrinker->nr, nr, new_nr) != nr);
 +              if (total_scan > 0)
 +                      new_nr = atomic_long_add_return(total_scan,
 +                                      &shrinker->nr_in_batch);
 +              else
 +                      new_nr = atomic_long_read(&shrinker->nr_in_batch);
  
                trace_mm_shrink_slab_end(shrinker, shrink_ret, nr, new_nr);
        }
@@@ -3475,16 -3475,16 +3475,16 @@@ int scan_unevictable_handler(struct ctl
   * a specified node's per zone unevictable lists for evictable pages.
   */
  
- static ssize_t read_scan_unevictable_node(struct sys_device *dev,
-                                         struct sysdev_attribute *attr,
+ static ssize_t read_scan_unevictable_node(struct device *dev,
+                                         struct device_attribute *attr,
                                          char *buf)
  {
        warn_scan_unevictable_pages();
        return sprintf(buf, "0\n");     /* always zero; should fit... */
  }
  
- static ssize_t write_scan_unevictable_node(struct sys_device *dev,
-                                          struct sysdev_attribute *attr,
+ static ssize_t write_scan_unevictable_node(struct device *dev,
+                                          struct device_attribute *attr,
                                        const char *buf, size_t count)
  {
        warn_scan_unevictable_pages();
  }
  
  
- static SYSDEV_ATTR(scan_unevictable_pages, S_IRUGO | S_IWUSR,
+ static DEVICE_ATTR(scan_unevictable_pages, S_IRUGO | S_IWUSR,
                        read_scan_unevictable_node,
                        write_scan_unevictable_node);
  
  int scan_unevictable_register_node(struct node *node)
  {
-       return sysdev_create_file(&node->sysdev, &attr_scan_unevictable_pages);
+       return device_create_file(&node->dev, &dev_attr_scan_unevictable_pages);
  }
  
  void scan_unevictable_unregister_node(struct node *node)
  {
-       sysdev_remove_file(&node->sysdev, &attr_scan_unevictable_pages);
+       device_remove_file(&node->dev, &dev_attr_scan_unevictable_pages);
  }
  #endif