Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6

* 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).
This commit is contained in:
Linus Torvalds
2008-04-21 15:49:58 -07:00
129 changed files with 3872 additions and 2315 deletions

View File

@@ -1,5 +1,5 @@
/*
* class_container.h - a generic container for all classes
* attribute_container.h - a generic container for all classes
*
* Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
*
@@ -18,7 +18,7 @@ struct attribute_container {
struct klist containers;
struct class *class;
struct attribute_group *grp;
struct class_device_attribute **attrs;
struct device_attribute **attrs;
int (*match)(struct attribute_container *, struct device *);
#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
unsigned long flags;
@@ -41,31 +41,31 @@ int __must_check attribute_container_unregister(struct attribute_container *cont
void attribute_container_create_device(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *,
struct class_device *));
struct device *));
void attribute_container_add_device(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *,
struct class_device *));
struct device *));
void attribute_container_remove_device(struct device *dev,
void (*fn)(struct attribute_container *,
struct device *,
struct class_device *));
struct device *));
void attribute_container_device_trigger(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *,
struct class_device *));
struct device *));
void attribute_container_trigger(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *));
int attribute_container_add_attrs(struct class_device *classdev);
int attribute_container_add_class_device(struct class_device *classdev);
int attribute_container_add_attrs(struct device *classdev);
int attribute_container_add_class_device(struct device *classdev);
int attribute_container_add_class_device_adapter(struct attribute_container *cont,
struct device *dev,
struct class_device *classdev);
void attribute_container_remove_attrs(struct class_device *classdev);
void attribute_container_class_device_del(struct class_device *classdev);
struct attribute_container *attribute_container_classdev_to_container(struct class_device *);
struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *);
struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev);
struct device *classdev);
void attribute_container_remove_attrs(struct device *classdev);
void attribute_container_class_device_del(struct device *classdev);
struct attribute_container *attribute_container_classdev_to_container(struct device *);
struct device *attribute_container_find_class_device(struct attribute_container *, struct device *);
struct device_attribute **attribute_container_classdev_to_attrs(const struct device *classdev);
#endif

View File

@@ -55,7 +55,7 @@ struct sg_io_v4 {
#if defined(CONFIG_BLK_DEV_BSG)
struct bsg_class_device {
struct class_device *class_dev;
struct device *class_dev;
struct device *dev;
int minor;
struct request_queue *queue;

View File

@@ -429,7 +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
@@ -475,6 +474,9 @@ struct device {
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 @@ static inline void dev_set_drvdata(struct device *dev, void *data)
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 @@ extern struct device *device_create(struct class *cls, struct device *parent,
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 @@ extern const char *dev_driver_string(struct device *dev);
#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. */

View File

@@ -82,7 +82,8 @@ struct enclosure_component_callbacks {
struct enclosure_component {
void *scratch;
struct class_device cdev;
struct device cdev;
struct device *dev;
enum enclosure_component_type type;
int number;
int fault;
@@ -94,20 +95,20 @@ struct enclosure_component {
struct enclosure_device {
void *scratch;
struct list_head node;
struct class_device cdev;
struct device edev;
struct enclosure_component_callbacks *cb;
int components;
struct enclosure_component component[0];
};
static inline struct enclosure_device *
to_enclosure_device(struct class_device *dev)
to_enclosure_device(struct device *dev)
{
return container_of(dev, struct enclosure_device, cdev);
return container_of(dev, struct enclosure_device, edev);
}
static inline struct enclosure_component *
to_enclosure_component(struct class_device *dev)
to_enclosure_component(struct device *dev)
{
return container_of(dev, struct enclosure_component, cdev);
}

View File

@@ -44,15 +44,7 @@ struct hwrng {
/** Register a new Hardware Random Number Generator driver. */
extern int hwrng_register(struct hwrng *rng);
/** Unregister a Hardware Random Number Generator driver. */
extern void __hwrng_unregister(struct hwrng *rng, bool suspended);
static inline void hwrng_unregister(struct hwrng *rng)
{
__hwrng_unregister(rng, false);
}
static inline void hwrng_unregister_suspended(struct hwrng *rng)
{
__hwrng_unregister(rng, true);
}
extern void hwrng_unregister(struct hwrng *rng);
#endif /* __KERNEL__ */
#endif /* LINUX_HWRANDOM_H_ */

View File

@@ -0,0 +1,50 @@
/*
* Copyright 2007 Red Hat, Inc.
* by Peter Jones <pjones@redhat.com>
* Copyright 2007 IBM, Inc.
* by Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
* Copyright 2008
* by Konrad Rzeszutek <ketuzsezr@darnok.org>
*
* This code exposes the iSCSI Boot Format Table to userland via sysfs.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License v2.0 as published by
* the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef ISCSI_IBFT_H
#define ISCSI_IBFT_H
struct ibft_table_header {
char signature[4];
u32 length;
u8 revision;
u8 checksum;
char oem_id[6];
char oem_table_id[8];
char reserved[24];
} __attribute__((__packed__));
/*
* Logical location of iSCSI Boot Format Table.
* If the value is NULL there is no iBFT on the machine.
*/
extern struct ibft_table_header *ibft_addr;
/*
* Routine used to find and reserve the iSCSI Boot Format Table. The
* mapped address is set in the ibft_addr variable.
*/
#ifdef CONFIG_ISCSI_IBFT_FIND
extern void __init reserve_ibft_region(void);
#else
static inline void reserve_ibft_region(void) { }
#endif
#endif /* ISCSI_IBFT_H */

View File

@@ -293,10 +293,8 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
#define pr_debug(fmt, arg...) \
printk(KERN_DEBUG fmt, ##arg)
#else
static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
{
return 0;
}
#define pr_debug(fmt, arg...) \
({ if (0) printk(KERN_DEBUG fmt, ##arg); 0; })
#endif
/*

View File

@@ -59,15 +59,7 @@ struct led_classdev {
extern int led_classdev_register(struct device *parent,
struct led_classdev *led_cdev);
extern void __led_classdev_unregister(struct led_classdev *led_cdev, bool sus);
static inline void led_classdev_unregister(struct led_classdev *lcd)
{
__led_classdev_unregister(lcd, false);
}
static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
{
__led_classdev_unregister(lcd, true);
}
extern void led_classdev_unregister(struct led_classdev *lcd);
extern void led_classdev_suspend(struct led_classdev *led_cdev);
extern void led_classdev_resume(struct led_classdev *led_cdev);

View File

@@ -443,7 +443,7 @@ enum link_pm {
MAX_PERFORMANCE,
MEDIUM_POWER,
};
extern struct class_device_attribute class_device_attr_link_power_management_policy;
extern struct device_attribute dev_attr_link_power_management_policy;
#ifdef CONFIG_ATA_SFF
struct ata_ioports {

View File

@@ -18,7 +18,7 @@
#include <linux/sysdev.h>
#include <linux/node.h>
#include <linux/compiler.h>
#include <linux/semaphore.h>
#include <linux/mutex.h>
struct memory_block {
unsigned long phys_index;
@@ -29,7 +29,7 @@ struct memory_block {
* created long after the critical areas during
* initialization.
*/
struct semaphore state_sem;
struct mutex state_mutex;
int phys_device; /* to which fru does this belong? */
void *hw; /* optional pointer to fw/hw data */
int (*phys_callback)(struct memory_block *);

View File

@@ -276,7 +276,7 @@ struct memstick_host {
#define MEMSTICK_CAP_PAR8 4
struct work_struct media_checker;
struct class_device cdev;
struct device dev;
struct memstick_dev *card;
unsigned int retries;

View File

@@ -43,15 +43,7 @@ struct miscdevice {
};
extern int misc_register(struct miscdevice * misc);
extern int __misc_deregister(struct miscdevice *misc, bool suspended);
static inline int misc_deregister(struct miscdevice *misc)
{
return __misc_deregister(misc, false);
}
static inline int misc_deregister_suspended(struct miscdevice *misc)
{
return __misc_deregister(misc, true);
}
extern int misc_deregister(struct miscdevice *misc);
#define MODULE_ALIAS_MISCDEV(minor) \
MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \

View File

@@ -183,8 +183,9 @@ typedef struct pm_message {
struct dev_pm_info {
pm_message_t power_state;
unsigned can_wakeup:1;
#ifdef CONFIG_PM_SLEEP
unsigned should_wakeup:1;
bool sleeping:1; /* Owned by the PM core */
#ifdef CONFIG_PM_SLEEP
struct list_head entry;
#endif
};
@@ -197,11 +198,6 @@ extern void device_resume(void);
extern int device_suspend(pm_message_t state);
extern int device_prepare_suspend(pm_message_t state);
#define device_set_wakeup_enable(dev,val) \
((dev)->power.should_wakeup = !!(val))
#define device_may_wakeup(dev) \
(device_can_wakeup(dev) && (dev)->power.should_wakeup)
extern void __suspend_report_result(const char *function, void *fn, int ret);
#define suspend_report_result(fn, ret) \
@@ -209,20 +205,6 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
__suspend_report_result(__FUNCTION__, fn, ret); \
} while (0)
/*
* Platform hook to activate device wakeup capability, if that's not already
* handled by enable_irq_wake() etc.
* Returns zero on success, else negative errno
*/
extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
{
if (platform_enable_wakeup)
return (*platform_enable_wakeup)(dev, is_on);
return 0;
}
#else /* !CONFIG_PM_SLEEP */
static inline int device_suspend(pm_message_t state)
@@ -230,29 +212,10 @@ static inline int device_suspend(pm_message_t state)
return 0;
}
#define device_set_wakeup_enable(dev,val) do{}while(0)
#define device_may_wakeup(dev) (0)
#define suspend_report_result(fn, ret) do { } while (0)
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
{
return 0;
}
#define suspend_report_result(fn, ret) do {} while (0)
#endif /* !CONFIG_PM_SLEEP */
/* changes to device_may_wakeup take effect on the next pm state change.
* by default, devices should wakeup if they can.
*/
#define device_can_wakeup(dev) \
((dev)->power.can_wakeup)
#define device_init_wakeup(dev,val) \
do { \
device_can_wakeup(dev) = !!(val); \
device_set_wakeup_enable(dev,val); \
} while(0)
/*
* Global Power Management flags
* Used to keep APM and ACPI from both being active

90
include/linux/pm_wakeup.h Normal file
View File

@@ -0,0 +1,90 @@
/*
* pm_wakeup.h - Power management wakeup interface
*
* Copyright (C) 2008 Alan Stern
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _LINUX_PM_WAKEUP_H
#define _LINUX_PM_WAKEUP_H
#ifndef _DEVICE_H_
# error "please don't include this file directly"
#endif
#ifdef CONFIG_PM
/* changes to device_may_wakeup take effect on the next pm state change.
* by default, devices should wakeup if they can.
*/
static inline void device_init_wakeup(struct device *dev, int val)
{
dev->power.can_wakeup = dev->power.should_wakeup = !!val;
}
static inline int device_can_wakeup(struct device *dev)
{
return dev->power.can_wakeup;
}
static inline void device_set_wakeup_enable(struct device *dev, int val)
{
dev->power.should_wakeup = !!val;
}
static inline int device_may_wakeup(struct device *dev)
{
return dev->power.can_wakeup & dev->power.should_wakeup;
}
/*
* Platform hook to activate device wakeup capability, if that's not already
* handled by enable_irq_wake() etc.
* Returns zero on success, else negative errno
*/
extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
{
if (platform_enable_wakeup)
return (*platform_enable_wakeup)(dev, is_on);
return 0;
}
#else /* !CONFIG_PM */
/* For some reason the next two routines work even without CONFIG_PM */
static inline void device_init_wakeup(struct device *dev, int val)
{
dev->power.can_wakeup = !!val;
}
static inline int device_can_wakeup(struct device *dev)
{
return dev->power.can_wakeup;
}
#define device_set_wakeup_enable(dev, val) do {} while (0)
#define device_may_wakeup(dev) 0
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
{
return 0;
}
#endif /* !CONFIG_PM */
#endif /* _LINUX_PM_WAKEUP_H */

View File

@@ -53,20 +53,20 @@ struct raid_data {
#define DEFINE_RAID_ATTRIBUTE(type, attr) \
static inline void \
raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \
struct class_device *cdev = \
struct device *device = \
attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
struct raid_data *rd; \
BUG_ON(!cdev); \
rd = class_get_devdata(cdev); \
BUG_ON(!device); \
rd = dev_get_drvdata(device); \
rd->attr = value; \
} \
static inline type \
raid_get_##attr(struct raid_template *r, struct device *dev) { \
struct class_device *cdev = \
struct device *device = \
attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
struct raid_data *rd; \
BUG_ON(!cdev); \
rd = class_get_devdata(cdev); \
BUG_ON(!device); \
rd = dev_get_drvdata(device); \
return rd->attr; \
}

View File

@@ -131,7 +131,6 @@ static inline int sysfs_create_dir(struct kobject *kobj)
static inline void sysfs_remove_dir(struct kobject *kobj)
{
;
}
static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name)
@@ -160,7 +159,6 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
static inline void sysfs_remove_file(struct kobject *kobj,
const struct attribute *attr)
{
;
}
static inline int sysfs_create_bin_file(struct kobject *kobj,
@@ -169,10 +167,9 @@ static inline int sysfs_create_bin_file(struct kobject *kobj,
return 0;
}
static inline int sysfs_remove_bin_file(struct kobject *kobj,
struct bin_attribute *attr)
static inline void sysfs_remove_bin_file(struct kobject *kobj,
struct bin_attribute *attr)
{
return 0;
}
static inline int sysfs_create_link(struct kobject *kobj,
@@ -183,7 +180,6 @@ static inline int sysfs_create_link(struct kobject *kobj,
static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
{
;
}
static inline int sysfs_create_group(struct kobject *kobj,
@@ -195,7 +191,6 @@ static inline int sysfs_create_group(struct kobject *kobj,
static inline void sysfs_remove_group(struct kobject *kobj,
const struct attribute_group *grp)
{
;
}
static inline int sysfs_add_file_to_group(struct kobject *kobj,

View File

@@ -17,11 +17,11 @@ struct transport_container;
struct transport_class {
struct class class;
int (*setup)(struct transport_container *, struct device *,
struct class_device *);
struct device *);
int (*configure)(struct transport_container *, struct device *,
struct class_device *);
struct device *);
int (*remove)(struct transport_container *, struct device *,
struct class_device *);
struct device *);
};
#define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \