Commit 9e0ce90e authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/gregkh/linux/driver-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents aa5743cc c5f192ee
......@@ -627,9 +627,6 @@ static int locomo_remove(struct device *dev)
if (lchip) {
__locomo_remove(lchip);
dev_set_drvdata(dev, NULL);
kfree(dev->saved_state);
dev->saved_state = NULL;
}
return 0;
......
......@@ -797,6 +797,8 @@ struct sa1111_save_data {
unsigned int wakeen1;
};
#ifdef CONFIG_PM
static int sa1111_suspend(struct device *dev, u32 state, u32 level)
{
struct sa1111 *sachip = dev_get_drvdata(dev);
......@@ -808,11 +810,10 @@ static int sa1111_suspend(struct device *dev, u32 state, u32 level)
if (level != SUSPEND_DISABLE)
return 0;
dev->saved_state = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
if (!dev->saved_state)
save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
if (!save)
return -ENOMEM;
save = (struct sa1111_save_data *)dev->saved_state;
dev->power.saved_state = save;
spin_lock_irqsave(&sachip->lock, flags);
......@@ -870,7 +871,7 @@ static int sa1111_resume(struct device *dev, u32 level)
if (level != RESUME_ENABLE)
return 0;
save = (struct sa1111_save_data *)dev->saved_state;
save = (struct sa1111_save_data *)dev->power.saved_state;
if (!save)
return 0;
......@@ -915,12 +916,18 @@ static int sa1111_resume(struct device *dev, u32 level)
spin_unlock_irqrestore(&sachip->lock, flags);
dev->saved_state = NULL;
dev->power.saved_state = NULL;
kfree(save);
return 0;
}
#else /* !CONFIG_PM */
#define sa1111_resume NULL
#define sa1111_suspend NULL
#endif /* !CONFIG_PM */
static int sa1111_probe(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
......@@ -943,8 +950,8 @@ static int sa1111_remove(struct device *dev)
__sa1111_remove(sachip);
dev_set_drvdata(dev, NULL);
kfree(dev->saved_state);
dev->saved_state = NULL;
kfree(dev->power.saved_state);
dev->power.saved_state = NULL;
}
return 0;
......
......@@ -173,6 +173,8 @@ static int neponset_probe(struct device *dev)
return 0;
}
#ifdef CONFIG_PM
/*
* LDM power management.
*/
......@@ -184,12 +186,12 @@ static int neponset_suspend(struct device *dev, u32 state, u32 level)
if (level == SUSPEND_SAVE_STATE ||
level == SUSPEND_DISABLE ||
level == SUSPEND_POWER_DOWN) {
if (!dev->saved_state)
dev->saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
if (!dev->saved_state)
if (!dev->power.saved_state)
dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
if (!dev->power.saved_state)
return -ENOMEM;
*(unsigned int *)dev->saved_state = NCR_0;
*(unsigned int *)dev->power.saved_state = NCR_0;
}
return 0;
......@@ -198,16 +200,21 @@ static int neponset_suspend(struct device *dev, u32 state, u32 level)
static int neponset_resume(struct device *dev, u32 level)
{
if (level == RESUME_RESTORE_STATE || level == RESUME_ENABLE) {
if (dev->saved_state) {
NCR_0 = *(unsigned int *)dev->saved_state;
kfree(dev->saved_state);
dev->saved_state = NULL;
if (dev->power.saved_state) {
NCR_0 = *(unsigned int *)dev->power.saved_state;
kfree(dev->power.saved_state);
dev->power.saved_state = NULL;
}
}
return 0;
}
#else
#define neponset_suspend NULL
#define neponset_resume NULL
#endif
static struct device_driver neponset_device_driver = {
.name = "neponset",
.bus = &platform_bus_type,
......
......@@ -247,7 +247,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
* device_bind_driver - bind a driver to one device.
* @dev: device.
*
* Allow manual attachment of a driver to a deivce.
* Allow manual attachment of a driver to a device.
* Caller must have already set @dev->driver.
*
* Note that this does not modify the bus reference count
......
......@@ -303,6 +303,12 @@ static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
buffer, buffer_size, &length,
"PHYSDEVBUS=%s", dev->bus->name);
/* add driver name of physical device */
if (dev->driver)
add_hotplug_env_var(envp, num_envp, &i,
buffer, buffer_size, &length,
"PHYSDEVDRIVER=%s", dev->driver->name);
/* terminate, set to next free slot, shrink available space */
envp[i] = NULL;
envp = &envp[i];
......
......@@ -116,8 +116,29 @@ static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
int num_envp, char *buffer, int buffer_size)
{
struct device *dev = to_dev(kobj);
int i = 0;
int length = 0;
int retval = 0;
/* add bus name of physical device */
if (dev->bus)
add_hotplug_env_var(envp, num_envp, &i,
buffer, buffer_size, &length,
"PHYSDEVBUS=%s", dev->bus->name);
/* add driver name of physical device */
if (dev->driver)
add_hotplug_env_var(envp, num_envp, &i,
buffer, buffer_size, &length,
"PHYSDEVDRIVER=%s", dev->driver->name);
/* terminate, set to next free slot, shrink available space */
envp[i] = NULL;
envp = &envp[i];
num_envp -= i;
buffer = &buffer[length];
buffer_size -= length;
if (dev->bus->hotplug) {
/* have the bus specific function add its stuff */
retval = dev->bus->hotplug (dev, envp, num_envp, buffer, buffer_size);
......
......@@ -469,6 +469,12 @@ static int block_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
buffer, buffer_size, &length,
"PHYSDEVBUS=%s", dev->bus->name);
/* add driver name of physical device */
if (dev->driver)
add_hotplug_env_var(envp, num_envp, &i,
buffer, buffer_size, &length,
"PHYSDEVDRIVER=%s", dev->driver->name);
envp[i] = NULL;
}
......
......@@ -2363,7 +2363,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, u32 state)
state = 2;
#endif /* CONFIG_PPC_PMAC */
if (state != 2 || state == pdev->dev.power_state)
if (state != 2 || state == pdev->dev.power.power_state)
return 0;
printk(KERN_DEBUG "aty128fb: suspending...\n");
......@@ -2394,7 +2394,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, u32 state)
release_console_sem();
pdev->dev.power_state = state;
pdev->dev.power.power_state = state;
return 0;
}
......@@ -2404,13 +2404,13 @@ static int aty128_pci_resume(struct pci_dev *pdev)
struct fb_info *info = pci_get_drvdata(pdev);
struct aty128fb_par *par = info->par;
if (pdev->dev.power_state == 0)
if (pdev->dev.power.power_state == 0)
return 0;
acquire_console_sem();
/* Wakeup chip */
if (pdev->dev.power_state == 2)
if (pdev->dev.power.power_state == 2)
aty128_set_suspend(par, 0);
par->asleep = 0;
......@@ -2430,7 +2430,7 @@ static int aty128_pci_resume(struct pci_dev *pdev)
release_console_sem();
pdev->dev.power_state = 0;
pdev->dev.power.power_state = 0;
printk(KERN_DEBUG "aty128fb: resumed !\n");
......
......@@ -2033,7 +2033,7 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, u32 state)
state = 2;
#endif /* CONFIG_PPC_PMAC */
if (state != 2 || state == pdev->dev.power_state)
if (state != 2 || state == pdev->dev.power.power_state)
return 0;
acquire_console_sem();
......@@ -2062,7 +2062,7 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, u32 state)
release_console_sem();
pdev->dev.power_state = state;
pdev->dev.power.power_state = state;
return 0;
}
......@@ -2072,12 +2072,12 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
struct fb_info *info = pci_get_drvdata(pdev);
struct atyfb_par *par = (struct atyfb_par *) info->par;
if (pdev->dev.power_state == 0)
if (pdev->dev.power.power_state == 0)
return 0;
acquire_console_sem();
if (pdev->dev.power_state == 2)
if (pdev->dev.power.power_state == 2)
aty_power_mgmt(0, par);
par->asleep = 0;
......@@ -2093,7 +2093,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
release_console_sem();
pdev->dev.power_state = 0;
pdev->dev.power.power_state = 0;
return 0;
}
......
......@@ -898,7 +898,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, u32 state)
release_console_sem();
pdev->dev.power_state = state;
pdev->dev.power.power_state = state;
return 0;
}
......@@ -908,7 +908,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
struct fb_info *info = pci_get_drvdata(pdev);
struct radeonfb_info *rinfo = info->par;
if (pdev->dev.power_state == 0)
if (pdev->dev.power.power_state == 0)
return 0;
acquire_console_sem();
......@@ -935,7 +935,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
release_console_sem();
pdev->dev.power_state = 0;
pdev->dev.power.power_state = 0;
printk(KERN_DEBUG "radeonfb: resumed !\n");
......
......@@ -38,7 +38,7 @@ static struct sysfs_dirent * sysfs_new_dirent(struct sysfs_dirent * parent_sd,
sd = kmalloc(sizeof(*sd), GFP_KERNEL);
if (!sd)
return ERR_PTR(-ENOMEM);
return NULL;
memset(sd, 0, sizeof(*sd));
atomic_set(&sd->s_count, 1);
......@@ -56,7 +56,7 @@ int sysfs_make_dirent(struct sysfs_dirent * parent_sd, struct dentry * dentry,
sd = sysfs_new_dirent(parent_sd, element);
if (!sd)
return 0;
return -ENOMEM;
sd->s_mode = mode;
sd->s_type = type;
......@@ -111,7 +111,7 @@ static int create_dir(struct kobject * k, struct dentry * p,
d_rehash(*d);
}
}
if (error)
if (error && (error != -EEXIST))
d_drop(*d);
dput(*d);
} else
......
......@@ -268,12 +268,7 @@ struct device {
void *platform_data; /* Platform specific data (e.g. ACPI,
BIOS data relevant to device) */
struct dev_pm_info power;
u32 power_state; /* Current operating state. In
ACPI-speak, this is D0-D3, D0
being fully functional, and D3
being off. */
unsigned char *saved_state; /* saved device state */
u32 detach_state; /* State to enter when device is
detached from its driver. */
......
......@@ -28,6 +28,7 @@ enum kobject_action {
KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */
KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */
KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */
KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */
};
......
......@@ -42,6 +42,8 @@ static char *action_to_string(enum kobject_action action)
return "umount";
case KOBJ_OFFLINE:
return "offline";
case KOBJ_ONLINE:
return "online";
default:
return NULL;
}
......@@ -287,10 +289,10 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action)
spin_lock(&sequence_lock);
seq = ++hotplug_seqnum;
spin_unlock(&sequence_lock);
sprintf(seq_buff, "SEQNUM=%lld", (long long)seq);
sprintf(seq_buff, "SEQNUM=%llu", (unsigned long long)seq);
pr_debug ("%s: %s %s seq=%lld %s %s %s %s %s\n",
__FUNCTION__, argv[0], argv[1], (long long)seq,
pr_debug ("%s: %s %s seq=%llu %s %s %s %s %s\n",
__FUNCTION__, argv[0], argv[1], (unsigned long long)seq,
envp[0], envp[1], envp[2], envp[3], envp[4]);
send_uevent(action_string, kobj_path, envp, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment