Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
Linus Torvalds [Mon, 21 Apr 2008 22:49:58 +0000 (15:49 -0700)]
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits)
  SCSI: convert struct class_device to struct device
  DRM: remove unused dev_class
  IB: rename "dev" to "srp_dev" in srp_host structure
  IB: convert struct class_device to struct device
  memstick: convert struct class_device to struct device
  driver core: replace remaining __FUNCTION__ occurrences
  sysfs: refill attribute buffer when reading from offset 0
  PM: Remove destroy_suspended_device()
  Firmware: add iSCSI iBFT Support
  PM: Remove legacy PM (fix)
  Kobject: Replace list_for_each() with list_for_each_entry().
  SYSFS: Explicitly include required header file slab.h.
  Driver core: make device_is_registered() work for class devices
  PM: Convert wakeup flag accessors to inline functions
  PM: Make wakeup flags available whenever CONFIG_PM is set
  PM: Fix misuse of wakeup flag accessors in serial core
  Driver core: Call device_pm_add() after bus_add_device() in device_add()
  PM: Handle device registrations during suspend/resume
  block: send disk "change" event for rescan_partitions()
  sysdev: detect multiple driver registrations
  ...

Fixed trivial conflict in include/linux/memory.h due to semaphore header
file change (made irrelevant by the change to mutex).

1  2 
MAINTAINERS
arch/arm/Kconfig
arch/x86/kernel/setup_32.c
arch/x86/kernel/setup_64.c
drivers/base/core.c
drivers/base/cpu.c
drivers/infiniband/core/user_mad.c
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/linit.c
include/linux/device.h

diff --combined MAINTAINERS
@@@ -486,12 -486,6 +486,12 @@@ M:       kernel@wantstofly.or
  L:    linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
  S:    Maintained
  
 +ARM/GUMSTIX MACHINE SUPPORT
 +P:    Steve Sakoman
 +M:    sakoman@gmail.com
 +L:    linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
 +S:    Maintained
 +
  ARM/HP JORNADA 7XX MACHINE SUPPORT
  P:      Kristoffer Ericson
  M:      kristoffer.ericson@gmail.com
@@@ -3610,6 -3604,11 +3610,11 @@@ M:    mhoffman@lightlink.co
  L:    lm-sensors@lm-sensors.org
  S:    Maintained
  
+ SMX UIO Interface
+ P:    Ben Nizette
+ M:    bn@niasdigital.com
+ S:    Maintained
  SOFTWARE RAID (Multiple Disks) SUPPORT
  P:    Ingo Molnar
  M:    mingo@redhat.com
diff --combined arch/arm/Kconfig
@@@ -255,7 -255,6 +255,7 @@@ config ARCH_EP93X
        select ARM_AMBA
        select ARM_VIC
        select GENERIC_GPIO
 +      select HAVE_GPIO_LIB
        help
          This enables support for the Cirrus EP93xx series of CPUs.
  
@@@ -378,17 -377,15 +378,17 @@@ config ARCH_MX
        help
          Support for Freescale MXC/iMX-based family of processors
  
 -config ARCH_ORION
 +config ARCH_ORION5X
        bool "Marvell Orion"
        depends on MMU
        select PCI
        select GENERIC_GPIO
        select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
 +      select PLAT_ORION
        help
 -        Support for Marvell Orion System on Chip family.
 +        Support for the following Marvell Orion 5x series SoCs:
 +        Orion-1 (5181), Orion-NAS (5182), Orion-2 (5281.)
  
  config ARCH_PNX4008
        bool "Philips Nexperia PNX4008 Mobile"
@@@ -425,15 -422,10 +425,15 @@@ config ARCH_SA110
        bool "SA1100-based"
        select ISA
        select ARCH_DISCONTIGMEM_ENABLE
 +      select ARCH_SPARSEMEM_ENABLE
 +      select ARCH_SELECT_MEMORY_MODEL
        select ARCH_MTD_XIP
        select GENERIC_GPIO
        select GENERIC_TIME
 +      select GENERIC_CLOCKEVENTS
 +      select TICK_ONESHOT
        select HAVE_IDE
 +      select HAVE_GPIO_LIB
        help
          Support for StrongARM 11x0 based boards.
  
@@@ -476,7 -468,6 +476,7 @@@ config ARCH_DAVINC
  config ARCH_OMAP
        bool "TI OMAP"
        select GENERIC_GPIO
 +      select HAVE_GPIO_LIB
        select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
        help
@@@ -525,7 -516,7 +525,7 @@@ source "arch/arm/mach-omap1/Kconfig
  
  source "arch/arm/mach-omap2/Kconfig"
  
 -source "arch/arm/mach-orion/Kconfig"
 +source "arch/arm/mach-orion5x/Kconfig"
  
  source "arch/arm/plat-s3c24xx/Kconfig"
  source "arch/arm/plat-s3c/Kconfig"
@@@ -572,9 -563,6 +572,9 @@@ config ARCH_ACOR
  config PLAT_IOP
        bool
  
 +config PLAT_ORION
 +      bool
 +
  source arch/arm/mm/Kconfig
  
  config IWMMXT
@@@ -662,7 -650,7 +662,7 @@@ source "kernel/time/Kconfig
  
  config SMP
        bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL && REALVIEW_EB_ARM11MP
 +      depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP)
        help
          This enables support for systems with more than one CPU. If you have
          a system with only one CPU, like most personal computers, say N. If
@@@ -695,7 -683,7 +695,7 @@@ config HOTPLUG_CP
  
  config LOCAL_TIMERS
        bool "Use local timer interrupts"
 -      depends on SMP && REALVIEW_EB_ARM11MP
 +      depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP)
        default y
        help
          Enable support for local timers on SMP platforms, rather then the
@@@ -786,12 -774,6 +786,12 @@@ config ARCH_DISCONTIGMEM_ENABL
          or have huge holes in the physical address space for other reasons.
          See <file:Documentation/vm/numa> for more.
  
 +config ARCH_SPARSEMEM_ENABLE
 +      bool
 +
 +config ARCH_SELECT_MEMORY_MODEL
 +      bool
 +
  config NODES_SHIFT
        int
        default "4" if ARCH_LH7A40X
@@@ -1192,6 -1174,8 +1192,8 @@@ source "drivers/dma/Kconfig
  
  source "drivers/dca/Kconfig"
  
+ source "drivers/uio/Kconfig"
  endmenu
  
  source "fs/Kconfig"
@@@ -39,6 -39,7 +39,7 @@@
  #include <linux/efi.h>
  #include <linux/init.h>
  #include <linux/edd.h>
+ #include <linux/iscsi_ibft.h>
  #include <linux/nodemask.h>
  #include <linux/kexec.h>
  #include <linux/crash_dump.h>
@@@ -689,6 -690,8 +690,8 @@@ void __init setup_bootmem_allocator(voi
  #endif
        numa_kva_reserve();
        reserve_crashkernel();
+       reserve_ibft_region();
  }
  
  /*
@@@ -812,10 -815,10 +815,10 @@@ void __init setup_arch(char **cmdline_p
                efi_init();
  
        /* update e820 for memory not covered by WB MTRRs */
 -      find_max_pfn();
 +      propagate_e820_map();
        mtrr_bp_init();
        if (mtrr_trim_uncached_memory(max_pfn))
 -              find_max_pfn();
 +              propagate_e820_map();
  
        max_low_pfn = setup_memory();
  
@@@ -33,6 -33,7 +33,7 @@@
  #include <linux/acpi.h>
  #include <linux/kallsyms.h>
  #include <linux/edd.h>
+ #include <linux/iscsi_ibft.h>
  #include <linux/mmzone.h>
  #include <linux/kexec.h>
  #include <linux/cpufreq.h>
@@@ -398,8 -399,6 +399,8 @@@ void __init setup_arch(char **cmdline_p
  
        early_res_to_bootmem();
  
 +      dma32_reserve_bootmem();
 +
  #ifdef CONFIG_ACPI_SLEEP
        /*
         * Reserve low memory region for sleep support.
                unsigned long end_of_mem    = end_pfn << PAGE_SHIFT;
  
                if (ramdisk_end <= end_of_mem) {
 -                      reserve_bootmem_generic(ramdisk_image, ramdisk_size);
 +                      /*
 +                       * don't need to reserve again, already reserved early
 +                       * in x86_64_start_kernel, and early_res_to_bootmem
 +                       * convert that to reserved in bootmem
 +                       */
                        initrd_start = ramdisk_image + PAGE_OFFSET;
                        initrd_end = initrd_start+ramdisk_size;
                } else {
 -                      /* Assumes everything on node 0 */
                        free_bootmem(ramdisk_image, ramdisk_size);
                        printk(KERN_ERR "initrd extends beyond end of memory "
                               "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
        }
  #endif
        reserve_crashkernel();
+       reserve_ibft_region();
        paging_init();
        map_vsyscall();
  
diff --combined drivers/base/core.c
@@@ -20,7 -20,7 +20,7 @@@
  #include <linux/notifier.h>
  #include <linux/genhd.h>
  #include <linux/kallsyms.h>
 -#include <asm/semaphore.h>
 +#include <linux/semaphore.h>
  
  #include "base.h"
  #include "power/power.h"
@@@ -207,7 -207,7 +207,7 @@@ static int dev_uevent(struct kset *kset
                retval = dev->bus->uevent(dev, env);
                if (retval)
                        pr_debug("device: '%s': %s: bus uevent() returned %d\n",
-                                dev->bus_id, __FUNCTION__, retval);
+                                dev->bus_id, __func__, retval);
        }
  
        /* have the class specific function add its stuff */
                if (retval)
                        pr_debug("device: '%s': %s: class uevent() "
                                 "returned %d\n", dev->bus_id,
-                                __FUNCTION__, retval);
+                                __func__, retval);
        }
  
        /* have the device type specific fuction add its stuff */
                if (retval)
                        pr_debug("device: '%s': %s: dev_type uevent() "
                                 "returned %d\n", dev->bus_id,
-                                __FUNCTION__, retval);
+                                __func__, retval);
        }
  
        return retval;
@@@ -782,7 -782,7 +782,7 @@@ int device_add(struct device *dev
                goto Done;
        }
  
-       pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
+       pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
  
        parent = get_device(dev->parent);
        setup_parent(dev, parent);
        error = device_add_attrs(dev);
        if (error)
                goto AttrsError;
        error = bus_add_device(dev);
        if (error)
                goto BusError;
+       error = device_pm_add(dev);
+       if (error)
+               goto PMError;
        kobject_uevent(&dev->kobj, KOBJ_ADD);
        bus_attach_device(dev);
        if (parent)
   Done:
        put_device(dev);
        return error;
-  BusError:
-       device_pm_remove(dev);
   PMError:
+       bus_remove_device(dev);
+  BusError:
        if (dev->bus)
                blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
                                             BUS_NOTIFY_DEL_DEVICE, dev);
@@@ -981,7 -980,7 +980,7 @@@ void device_del(struct device *dev
   */
  void device_unregister(struct device *dev)
  {
-       pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
+       pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
        device_del(dev);
        put_device(dev);
  }
@@@ -1076,7 -1075,7 +1075,7 @@@ EXPORT_SYMBOL_GPL(device_remove_file)
  
  static void device_create_release(struct device *dev)
  {
-       pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
+       pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
        kfree(dev);
  }
  
@@@ -1164,35 -1163,6 +1163,6 @@@ void device_destroy(struct class *class
  }
  EXPORT_SYMBOL_GPL(device_destroy);
  
- #ifdef CONFIG_PM_SLEEP
- /**
-  * destroy_suspended_device - asks the PM core to remove a suspended device
-  * @class: pointer to the struct class that this device was registered with
-  * @devt: the dev_t of the device that was previously registered
-  *
-  * This call notifies the PM core of the necessity to unregister a suspended
-  * device created with a call to device_create() (devices cannot be
-  * unregistered directly while suspended, since the PM core holds their
-  * semaphores at that time).
-  *
-  * It can only be called within the scope of a system sleep transition.  In
-  * practice this means it has to be directly or indirectly invoked either by
-  * a suspend or resume method, or by the PM core (e.g. via
-  * disable_nonboot_cpus() or enable_nonboot_cpus()).
-  */
- void destroy_suspended_device(struct class *class, dev_t devt)
- {
-       struct device *dev;
-       dev = class_find_device(class, &devt, __match_devt);
-       if (dev) {
-               device_pm_schedule_removal(dev);
-               put_device(dev);
-       }
- }
- EXPORT_SYMBOL_GPL(destroy_suspended_device);
- #endif /* CONFIG_PM_SLEEP */
  /**
   * device_rename - renames a device
   * @dev: the pointer to the struct device to be renamed
@@@ -1210,7 -1180,7 +1180,7 @@@ int device_rename(struct device *dev, c
                return -EINVAL;
  
        pr_debug("device: '%s': %s: renaming to '%s'\n", dev->bus_id,
-                __FUNCTION__, new_name);
+                __func__, new_name);
  
  #ifdef CONFIG_SYSFS_DEPRECATED
        if ((dev->class) && (dev->parent))
                                          dev->bus_id);
                if (error) {
                        dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n",
-                               __FUNCTION__, error);
+                               __func__, error);
                }
        }
  #endif
@@@ -1325,7 -1295,7 +1295,7 @@@ int device_move(struct device *dev, str
        new_parent_kobj = get_device_parent(dev, new_parent);
  
        pr_debug("device: '%s': %s: moving to '%s'\n", dev->bus_id,
-                __FUNCTION__, new_parent ? new_parent->bus_id : "<NULL>");
+                __func__, new_parent ? new_parent->bus_id : "<NULL>");
        error = kobject_move(&dev->kobj, new_parent_kobj);
        if (error) {
                cleanup_glue_dir(dev, new_parent_kobj);
diff --combined drivers/base/cpu.c
@@@ -28,7 -28,7 +28,7 @@@ static ssize_t show_online(struct sys_d
        return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id));
  }
  
- static ssize_t store_online(struct sys_device *dev, const char *buf,
+ static ssize_t __ref store_online(struct sys_device *dev, const char *buf,
                            size_t count)
  {
        struct cpu *cpu = container_of(dev, struct cpu, sysdev);
@@@ -55,7 -55,7 +55,7 @@@
  }
  static SYSDEV_ATTR(online, 0644, show_online, store_online);
  
- static void __devinit register_cpu_control(struct cpu *cpu)
+ static void __cpuinit register_cpu_control(struct cpu *cpu)
  {
        sysdev_create_file(&cpu->sysdev, &attr_online);
  }
@@@ -103,51 -103,6 +103,51 @@@ static SYSDEV_ATTR(crash_notes, 0400, s
  #endif
  
  /*
 + * Print cpu online, possible, present, and system maps
 + */
 +static ssize_t print_cpus_map(char *buf, cpumask_t *map)
 +{
 +      int n = cpulist_scnprintf(buf, PAGE_SIZE-2, *map);
 +
 +      buf[n++] = '\n';
 +      buf[n] = '\0';
 +      return n;
 +}
 +
 +#define       print_cpus_func(type) \
 +static ssize_t print_cpus_##type(struct sysdev_class *class, char *buf)       \
 +{                                                                     \
 +      return print_cpus_map(buf, &cpu_##type##_map);                  \
 +}                                                                     \
 +struct sysdev_class_attribute attr_##type##_map =                     \
 +      _SYSDEV_CLASS_ATTR(type, 0444, print_cpus_##type, NULL)
 +
 +print_cpus_func(online);
 +print_cpus_func(possible);
 +print_cpus_func(present);
 +
 +struct sysdev_class_attribute *cpu_state_attr[] = {
 +      &attr_online_map,
 +      &attr_possible_map,
 +      &attr_present_map,
 +};
 +
 +static int cpu_states_init(void)
 +{
 +      int i;
 +      int err = 0;
 +
 +      for (i = 0;  i < ARRAY_SIZE(cpu_state_attr); i++) {
 +              int ret;
 +              ret = sysdev_class_create_file(&cpu_sysdev_class,
 +                                              cpu_state_attr[i]);
 +              if (!err)
 +                      err = ret;
 +      }
 +      return err;
 +}
 +
 +/*
   * register_cpu - Setup a sysfs device for a CPU.
   * @cpu - cpu->hotpluggable field set to 1 will generate a control file in
   *      sysfs for this CPU.
@@@ -192,9 -147,6 +192,9 @@@ int __init cpu_dev_init(void
        int err;
  
        err = sysdev_class_register(&cpu_sysdev_class);
 +      if (!err)
 +              err = cpu_states_init();
 +
  #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
        if (!err)
                err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class);
@@@ -46,9 -46,9 +46,9 @@@
  #include <linux/mutex.h>
  #include <linux/kref.h>
  #include <linux/compat.h>
 +#include <linux/semaphore.h>
  
  #include <asm/uaccess.h>
 -#include <asm/semaphore.h>
  
  #include <rdma/ib_mad.h>
  #include <rdma/ib_user_mad.h>
@@@ -88,11 -88,11 +88,11 @@@ enum 
   */
  
  struct ib_umad_port {
-       struct cdev           *dev;
-       struct class_device   *class_dev;
+       struct cdev           *cdev;
+       struct device         *dev;
  
-       struct cdev           *sm_dev;
-       struct class_device   *sm_class_dev;
+       struct cdev           *sm_cdev;
+       struct device         *sm_dev;
        struct semaphore       sm_sem;
  
        struct mutex           file_mutex;
@@@ -948,27 -948,29 +948,29 @@@ static struct ib_client umad_client = 
        .remove = ib_umad_remove_one
  };
  
- static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
+ static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr,
+                         char *buf)
  {
-       struct ib_umad_port *port = class_get_devdata(class_dev);
+       struct ib_umad_port *port = dev_get_drvdata(dev);
  
        if (!port)
                return -ENODEV;
  
        return sprintf(buf, "%s\n", port->ib_dev->name);
  }
- static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
+ static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
  
- static ssize_t show_port(struct class_device *class_dev, char *buf)
+ static ssize_t show_port(struct device *dev, struct device_attribute *attr,
+                        char *buf)
  {
-       struct ib_umad_port *port = class_get_devdata(class_dev);
+       struct ib_umad_port *port = dev_get_drvdata(dev);
  
        if (!port)
                return -ENODEV;
  
        return sprintf(buf, "%d\n", port->port_num);
  }
- static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
+ static DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
  
  static ssize_t show_abi_version(struct class *class, char *buf)
  {
@@@ -994,48 -996,47 +996,47 @@@ static int ib_umad_init_port(struct ib_
        mutex_init(&port->file_mutex);
        INIT_LIST_HEAD(&port->file_list);
  
-       port->dev = cdev_alloc();
-       if (!port->dev)
+       port->cdev = cdev_alloc();
+       if (!port->cdev)
                return -1;
-       port->dev->owner = THIS_MODULE;
-       port->dev->ops   = &umad_fops;
-       kobject_set_name(&port->dev->kobj, "umad%d", port->dev_num);
-       if (cdev_add(port->dev, base_dev + port->dev_num, 1))
+       port->cdev->owner = THIS_MODULE;
+       port->cdev->ops   = &umad_fops;
+       kobject_set_name(&port->cdev->kobj, "umad%d", port->dev_num);
+       if (cdev_add(port->cdev, base_dev + port->dev_num, 1))
                goto err_cdev;
  
-       port->class_dev = class_device_create(umad_class, NULL, port->dev->dev,
-                                             device->dma_device,
-                                             "umad%d", port->dev_num);
-       if (IS_ERR(port->class_dev))
+       port->dev = device_create(umad_class, device->dma_device,
+                                 port->cdev->dev, "umad%d", port->dev_num);
+       if (IS_ERR(port->dev))
                goto err_cdev;
  
-       if (class_device_create_file(port->class_dev, &class_device_attr_ibdev))
-               goto err_class;
-       if (class_device_create_file(port->class_dev, &class_device_attr_port))
-               goto err_class;
-       port->sm_dev = cdev_alloc();
-       if (!port->sm_dev)
-               goto err_class;
-       port->sm_dev->owner = THIS_MODULE;
-       port->sm_dev->ops   = &umad_sm_fops;
-       kobject_set_name(&port->sm_dev->kobj, "issm%d", port->dev_num);
-       if (cdev_add(port->sm_dev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1))
+       if (device_create_file(port->dev, &dev_attr_ibdev))
+               goto err_dev;
+       if (device_create_file(port->dev, &dev_attr_port))
+               goto err_dev;
+       port->sm_cdev = cdev_alloc();
+       if (!port->sm_cdev)
+               goto err_dev;
+       port->sm_cdev->owner = THIS_MODULE;
+       port->sm_cdev->ops   = &umad_sm_fops;
+       kobject_set_name(&port->sm_cdev->kobj, "issm%d", port->dev_num);
+       if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1))
                goto err_sm_cdev;
  
-       port->sm_class_dev = class_device_create(umad_class, NULL, port->sm_dev->dev,
-                                                device->dma_device,
-                                                "issm%d", port->dev_num);
-       if (IS_ERR(port->sm_class_dev))
+       port->sm_dev = device_create(umad_class, device->dma_device,
+                                    port->sm_cdev->dev,
+                                    "issm%d", port->dev_num);
+       if (IS_ERR(port->sm_dev))
                goto err_sm_cdev;
  
-       class_set_devdata(port->class_dev,    port);
-       class_set_devdata(port->sm_class_dev, port);
+       dev_set_drvdata(port->dev,    port);
+       dev_set_drvdata(port->sm_dev, port);
  
-       if (class_device_create_file(port->sm_class_dev, &class_device_attr_ibdev))
-               goto err_sm_class;
-       if (class_device_create_file(port->sm_class_dev, &class_device_attr_port))
-               goto err_sm_class;
+       if (device_create_file(port->sm_dev, &dev_attr_ibdev))
+               goto err_sm_dev;
+       if (device_create_file(port->sm_dev, &dev_attr_port))
+               goto err_sm_dev;
  
        spin_lock(&port_lock);
        umad_port[port->dev_num] = port;
  
        return 0;
  
- err_sm_class:
-       class_device_destroy(umad_class, port->sm_dev->dev);
+ err_sm_dev:
+       device_destroy(umad_class, port->sm_cdev->dev);
  
  err_sm_cdev:
-       cdev_del(port->sm_dev);
+       cdev_del(port->sm_cdev);
  
- err_class:
-       class_device_destroy(umad_class, port->dev->dev);
+ err_dev:
+       device_destroy(umad_class, port->cdev->dev);
  
  err_cdev:
-       cdev_del(port->dev);
+       cdev_del(port->cdev);
        clear_bit(port->dev_num, dev_map);
  
        return -1;
@@@ -1065,14 -1066,14 +1066,14 @@@ static void ib_umad_kill_port(struct ib
        int already_dead;
        int id;
  
-       class_set_devdata(port->class_dev,    NULL);
-       class_set_devdata(port->sm_class_dev, NULL);
+       dev_set_drvdata(port->dev,    NULL);
+       dev_set_drvdata(port->sm_dev, NULL);
  
-       class_device_destroy(umad_class, port->dev->dev);
-       class_device_destroy(umad_class, port->sm_dev->dev);
+       device_destroy(umad_class, port->cdev->dev);
+       device_destroy(umad_class, port->sm_cdev->dev);
  
-       cdev_del(port->dev);
-       cdev_del(port->sm_dev);
+       cdev_del(port->cdev);
+       cdev_del(port->sm_cdev);
  
        spin_lock(&port_lock);
        umad_port[port->dev_num] = NULL;
@@@ -31,6 -31,7 +31,6 @@@
  #include <linux/slab.h>
  #include <linux/completion.h>
  #include <linux/blkdev.h>
 -#include <asm/semaphore.h>
  #include <asm/uaccess.h>
  #include <linux/highmem.h> /* For flush_kernel_dcache_page */
  
@@@ -1315,7 -1316,7 +1315,7 @@@ int aac_get_adapter_info(struct aac_dev
                        tmp>>24,(tmp>>16)&0xff,tmp&0xff,
                        le32_to_cpu(dev->adapter_info.biosbuild));
                buffer[0] = '\0';
-               if (aac_show_serial_number(
+               if (aac_get_serial_number(
                  shost_to_class(dev->scsi_host_ptr), buffer))
                        printk(KERN_INFO "%s%d: serial %s",
                          dev->name, dev->id, buffer);
@@@ -42,6 -42,7 +42,6 @@@
  #include <linux/syscalls.h>
  #include <linux/delay.h>
  #include <linux/kthread.h>
 -#include <asm/semaphore.h>
  
  #include <scsi/scsi.h>
  #include <scsi/scsi_cmnd.h>
@@@ -754,10 -755,10 +754,10 @@@ static long aac_compat_cfg_ioctl(struc
  }
  #endif
  
- static ssize_t aac_show_model(struct class_device *class_dev,
-               char *buf)
+ static ssize_t aac_show_model(struct device *device,
+                             struct device_attribute *attr, char *buf)
  {
-       struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
+       struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
        int len;
  
        if (dev->supplement_adapter_info.AdapterTypeText[0]) {
        return len;
  }
  
- static ssize_t aac_show_vendor(struct class_device *class_dev,
-               char *buf)
+ static ssize_t aac_show_vendor(struct device *device,
+                              struct device_attribute *attr, char *buf)
  {
-       struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
+       struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
        int len;
  
        if (dev->supplement_adapter_info.AdapterTypeText[0]) {
        return len;
  }
  
- static ssize_t aac_show_flags(struct class_device *class_dev, char *buf)
+ static ssize_t aac_show_flags(struct device *cdev,
+                             struct device_attribute *attr, char *buf)
  {
        int len = 0;
-       struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
+       struct aac_dev *dev = (struct aac_dev*)class_to_shost(cdev)->hostdata;
  
        if (nblank(dprintk(x)))
                len = snprintf(buf, PAGE_SIZE, "dprintk\n");
        return len;
  }
  
- static ssize_t aac_show_kernel_version(struct class_device *class_dev,
-               char *buf)
+ static ssize_t aac_show_kernel_version(struct device *device,
+                                      struct device_attribute *attr,
+                                      char *buf)
  {
-       struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
+       struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
        int len, tmp;
  
        tmp = le32_to_cpu(dev->adapter_info.kernelrev);
        return len;
  }
  
- static ssize_t aac_show_monitor_version(struct class_device *class_dev,
-               char *buf)
+ static ssize_t aac_show_monitor_version(struct device *device,
+                                       struct device_attribute *attr,
+                                       char *buf)
  {
-       struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
+       struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
        int len, tmp;
  
        tmp = le32_to_cpu(dev->adapter_info.monitorrev);
        return len;
  }
  
- static ssize_t aac_show_bios_version(struct class_device *class_dev,
-               char *buf)
+ static ssize_t aac_show_bios_version(struct device *device,
+                                    struct device_attribute *attr,
+                                    char *buf)
  {
-       struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
+       struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
        int len, tmp;
  
        tmp = le32_to_cpu(dev->adapter_info.biosrev);
        return len;
  }
  
- ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf)
+ ssize_t aac_show_serial_number(struct device *device,
+                              struct device_attribute *attr, char *buf)
  {
-       struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
+       struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
        int len = 0;
  
        if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0)
        return len;
  }
  
- static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf)
+ static ssize_t aac_show_max_channel(struct device *device,
+                                   struct device_attribute *attr, char *buf)
  {
        return snprintf(buf, PAGE_SIZE, "%d\n",
-         class_to_shost(class_dev)->max_channel);
+         class_to_shost(device)->max_channel);
  }
  
- static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf)
+ static ssize_t aac_show_max_id(struct device *device,
+                              struct device_attribute *attr, char *buf)
  {
        return snprintf(buf, PAGE_SIZE, "%d\n",
-         class_to_shost(class_dev)->max_id);
+         class_to_shost(device)->max_id);
  }
  
- static ssize_t aac_store_reset_adapter(struct class_device *class_dev,
-               const char *buf, size_t count)
+ static ssize_t aac_store_reset_adapter(struct device *device,
+                                      struct device_attribute *attr,
+                                      const char *buf, size_t count)
  {
        int retval = -EACCES;
  
        if (!capable(CAP_SYS_ADMIN))
                return retval;
-       retval = aac_reset_adapter((struct aac_dev*)class_to_shost(class_dev)->hostdata, buf[0] == '!');
+       retval = aac_reset_adapter((struct aac_dev*)class_to_shost(device)->hostdata, buf[0] == '!');
        if (retval >= 0)
                retval = count;
        return retval;
  }
  
- static ssize_t aac_show_reset_adapter(struct class_device *class_dev,
-               char *buf)
+ static ssize_t aac_show_reset_adapter(struct device *device,
+                                     struct device_attribute *attr,
+                                     char *buf)
  {
-       struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
+       struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
        int len, tmp;
  
        tmp = aac_adapter_check_health(dev);
        return len;
  }
  
- static struct class_device_attribute aac_model = {
+ static struct device_attribute aac_model = {
        .attr = {
                .name = "model",
                .mode = S_IRUGO,
        },
        .show = aac_show_model,
  };
- static struct class_device_attribute aac_vendor = {
+ static struct device_attribute aac_vendor = {
        .attr = {
                .name = "vendor",
                .mode = S_IRUGO,
        },
        .show = aac_show_vendor,
  };
- static struct class_device_attribute aac_flags = {
+ static struct device_attribute aac_flags = {
        .attr = {
                .name = "flags",
                .mode = S_IRUGO,
        },
        .show = aac_show_flags,
  };
- static struct class_device_attribute aac_kernel_version = {
+ static struct device_attribute aac_kernel_version = {
        .attr = {
                .name = "hba_kernel_version",
                .mode = S_IRUGO,
        },
        .show = aac_show_kernel_version,
  };
- static struct class_device_attribute aac_monitor_version = {
+ static struct device_attribute aac_monitor_version = {
        .attr = {
                .name = "hba_monitor_version",
                .mode = S_IRUGO,
        },
        .show = aac_show_monitor_version,
  };
- static struct class_device_attribute aac_bios_version = {
+ static struct device_attribute aac_bios_version = {
        .attr = {
                .name = "hba_bios_version",
                .mode = S_IRUGO,
        },
        .show = aac_show_bios_version,
  };
- static struct class_device_attribute aac_serial_number = {
+ static struct device_attribute aac_serial_number = {
        .attr = {
                .name = "serial_number",
                .mode = S_IRUGO,
        },
        .show = aac_show_serial_number,
  };
- static struct class_device_attribute aac_max_channel = {
+ static struct device_attribute aac_max_channel = {
        .attr = {
                .name = "max_channel",
                .mode = S_IRUGO,
        },
        .show = aac_show_max_channel,
  };
- static struct class_device_attribute aac_max_id = {
+ static struct device_attribute aac_max_id = {
        .attr = {
                .name = "max_id",
                .mode = S_IRUGO,
        },
        .show = aac_show_max_id,
  };
- static struct class_device_attribute aac_reset = {
+ static struct device_attribute aac_reset = {
        .attr = {
                .name = "reset_host",
                .mode = S_IWUSR|S_IRUGO,
        .show = aac_show_reset_adapter,
  };
  
- static struct class_device_attribute *aac_attrs[] = {
+ static struct device_attribute *aac_attrs[] = {
        &aac_model,
        &aac_vendor,
        &aac_flags,
        NULL
  };
  
+ ssize_t aac_get_serial_number(struct device *device, char *buf)
+ {
+       return aac_show_serial_number(device, &aac_serial_number, buf);
+ }
  
  static const struct file_operations aac_cfg_fops = {
        .owner          = THIS_MODULE,
diff --combined include/linux/device.h
@@@ -20,7 -20,7 +20,7 @@@
  #include <linux/types.h>
  #include <linux/module.h>
  #include <linux/pm.h>
 -#include <asm/semaphore.h>
 +#include <linux/semaphore.h>
  #include <asm/atomic.h>
  #include <asm/device.h>
  
@@@ -429,7 -429,6 +429,6 @@@ struct device 
        struct kobject kobj;
        char    bus_id[BUS_ID_SIZE];    /* position on parent bus */
        struct device_type      *type;
-       unsigned                is_registered:1;
        unsigned                uevent_suppress:1;
  
        struct semaphore        sem;    /* semaphore to synchronize calls to
        void    (*release)(struct device *dev);
  };
  
+ /* Get the wakeup routines, which depend on struct device */
+ #include <linux/pm_wakeup.h>
  #ifdef CONFIG_NUMA
  static inline int dev_to_node(struct device *dev)
  {
@@@ -506,7 -508,7 +508,7 @@@ static inline void dev_set_drvdata(stru
  
  static inline int device_is_registered(struct device *dev)
  {
-       return dev->is_registered;
+       return dev->kobj.state_in_sysfs;
  }
  
  void driver_init(void);
@@@ -543,20 -545,6 +545,6 @@@ extern struct device *device_create(str
                                    dev_t devt, const char *fmt, ...)
                                    __attribute__((format(printf, 4, 5)));
  extern void device_destroy(struct class *cls, dev_t devt);
- #ifdef CONFIG_PM_SLEEP
- extern void destroy_suspended_device(struct class *cls, dev_t devt);
- extern void device_pm_schedule_removal(struct device *);
- #else /* !CONFIG_PM_SLEEP */
- static inline void destroy_suspended_device(struct class *cls, dev_t devt)
- {
-       device_destroy(cls, devt);
- }
- static inline void device_pm_schedule_removal(struct device *dev)
- {
-       device_unregister(dev);
- }
- #endif /* !CONFIG_PM_SLEEP */
  
  /*
   * Platform "fixup" functions - allow the platform to have their say
@@@ -608,21 -596,16 +596,16 @@@ extern const char *dev_driver_string(st
  #define dev_dbg(dev, format, arg...)          \
        dev_printk(KERN_DEBUG , dev , format , ## arg)
  #else
- static inline int __attribute__ ((format (printf, 2, 3)))
- dev_dbg(struct device *dev, const char *fmt, ...)
- {
-       return 0;
- }
+ #define dev_dbg(dev, format, arg...)          \
+       ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
  #endif
  
  #ifdef VERBOSE_DEBUG
  #define dev_vdbg      dev_dbg
  #else
- static inline int __attribute__ ((format (printf, 2, 3)))
- dev_vdbg(struct device *dev, const char *fmt, ...)
- {
-       return 0;
- }
+ #define dev_vdbg(dev, format, arg...)         \
+       ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
  #endif
  
  /* Create alias, so I can be autoloaded. */