Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82631
b: refs/heads/master
c: c6fa0b0
h: refs/heads/master
i:
  82629: 41b8a26
  82627: 913fdcd
  82623: 05d2810
v: v3
  • Loading branch information
Doug Maxey authored and David S. Miller committed Feb 3, 2008
1 parent f89e54b commit 81e662b
Show file tree
Hide file tree
Showing 27 changed files with 1,080 additions and 200 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a6cc48eeea438b9d9e05943beebc31c52e76d32f
refs/heads/master: c6fa0b03cdf7d973988193c2b7d768f01e1dc2ae
6 changes: 3 additions & 3 deletions trunk/Documentation/driver-model/platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ None the less, there are some APIs to support such legacy drivers. Avoid
using these calls except with such hotplug-deficient drivers.

struct platform_device *platform_device_alloc(
const char *name, int id);
char *name, unsigned id);

You can use platform_device_alloc() to dynamically allocate a device, which
you will then initialize with resources and platform_device_register().
A better solution is usually:

struct platform_device *platform_device_register_simple(
const char *name, int id,
struct resource *res, unsigned int nres);
char *name, unsigned id,
struct resource *res, unsigned nres);

You can use platform_device_register_simple() as a one-step call to allocate
and register a device.
Expand Down
79 changes: 0 additions & 79 deletions trunk/Documentation/ja_JP/stable_kernel_rules.txt

This file was deleted.

40 changes: 27 additions & 13 deletions trunk/drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,10 @@ struct kset *devices_kset;
int device_create_file(struct device *dev, struct device_attribute *attr)
{
int error = 0;
if (dev)
if (get_device(dev)) {
error = sysfs_create_file(&dev->kobj, &attr->attr);
put_device(dev);
}
return error;
}

Expand All @@ -435,8 +437,10 @@ int device_create_file(struct device *dev, struct device_attribute *attr)
*/
void device_remove_file(struct device *dev, struct device_attribute *attr)
{
if (dev)
if (get_device(dev)) {
sysfs_remove_file(&dev->kobj, &attr->attr);
put_device(dev);
}
}

/**
Expand Down Expand Up @@ -1140,11 +1144,25 @@ struct device *device_create(struct class *class, struct device *parent,
}
EXPORT_SYMBOL_GPL(device_create);

static int __match_devt(struct device *dev, void *data)
/**
* find_device - finds a device that was created with device_create()
* @class: pointer to the struct class that this device was registered with
* @devt: the dev_t of the device that was previously registered
*/
static struct device *find_device(struct class *class, dev_t devt)
{
dev_t *devt = data;
struct device *dev = NULL;
struct device *dev_tmp;

return dev->devt == *devt;
down(&class->sem);
list_for_each_entry(dev_tmp, &class->devices, node) {
if (dev_tmp->devt == devt) {
dev = dev_tmp;
break;
}
}
up(&class->sem);
return dev;
}

/**
Expand All @@ -1159,11 +1177,9 @@ void device_destroy(struct class *class, dev_t devt)
{
struct device *dev;

dev = class_find_device(class, &devt, __match_devt);
if (dev) {
put_device(dev);
dev = find_device(class, devt);
if (dev)
device_unregister(dev);
}
}
EXPORT_SYMBOL_GPL(device_destroy);

Expand All @@ -1187,11 +1203,9 @@ void destroy_suspended_device(struct class *class, dev_t devt)
{
struct device *dev;

dev = class_find_device(class, &devt, __match_devt);
if (dev) {
dev = find_device(class, devt);
if (dev)
device_pm_schedule_removal(dev);
put_device(dev);
}
}
EXPORT_SYMBOL_GPL(destroy_suspended_device);
#endif /* CONFIG_PM_SLEEP */
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/base/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ int driver_create_file(struct device_driver *drv,
struct driver_attribute *attr)
{
int error;
if (drv)
if (get_driver(drv)) {
error = sysfs_create_file(&drv->p->kobj, &attr->attr);
else
put_driver(drv);
} else
error = -EINVAL;
return error;
}
Expand All @@ -113,8 +114,10 @@ EXPORT_SYMBOL_GPL(driver_create_file);
void driver_remove_file(struct device_driver *drv,
struct driver_attribute *attr)
{
if (drv)
if (get_driver(drv)) {
sysfs_remove_file(&drv->p->kobj, &attr->attr);
put_driver(drv);
}
}
EXPORT_SYMBOL_GPL(driver_remove_file);

Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ void device_pm_schedule_removal(struct device *dev)
list_move_tail(&dev->power.entry, &dpm_destroy);
mutex_unlock(&dpm_list_mtx);
}
EXPORT_SYMBOL_GPL(device_pm_schedule_removal);

/**
* pm_sleep_lock - mutual exclusion for registration and suspend
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/base/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ static inline struct device *to_device(struct list_head *entry)

extern void device_pm_add(struct device *);
extern void device_pm_remove(struct device *);
extern void device_pm_schedule_removal(struct device *);
extern int pm_sleep_lock(void);
extern void pm_sleep_unlock(void);

Expand Down
Loading

0 comments on commit 81e662b

Please sign in to comment.