You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (28 commits) sysfs: Shadow directory support Driver Core: Increase the default timeout value of the firmware subsystem Driver core: allow to delay the uevent at device creation time Driver core: add device_type to struct device Driver core: add uevent vars for devices of a class SYSFS: Fix missing include of list.h in sysfs.h HOWTO: Add a reference to Harbison and Steele sysfs: error handling in sysfs, fill_read_buffer() kobject: kobject_put cleanup sysfs: kobject_put cleanup sysfs: suppress lockdep warnings Driver core: fix race in sysfs between sysfs_remove_file() and read()/write() driver core: Change function call order in device_bind_driver(). driver core: Don't stop probing on ->probe errors. driver core fixes: device_register() retval check in platform.c driver core fixes: make_class_name() retval checks /sys/modules/*/holders USB: add the sysfs driver name to all modules SERIO: add the sysfs driver name to all modules PCI: add the sysfs driver name to all modules ...
This commit is contained in:
@@ -30,6 +30,7 @@ are not a good substitute for a solid C education and/or years of
|
||||
experience, the following books are good for, if anything, reference:
|
||||
- "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
|
||||
- "Practical C Programming" by Steve Oualline [O'Reilly]
|
||||
- "C: A Reference Manual" by Harbison and Steele [Prentice Hall]
|
||||
|
||||
The kernel is written using GNU C and the GNU toolchain. While it
|
||||
adheres to the ISO C89 standard, it uses a number of extensions that are
|
||||
|
||||
+14
-7
@@ -364,7 +364,7 @@ char *make_class_name(const char *name, struct kobject *kobj)
|
||||
|
||||
class_name = kmalloc(size, GFP_KERNEL);
|
||||
if (!class_name)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
return NULL;
|
||||
|
||||
strcpy(class_name, name);
|
||||
strcat(class_name, ":");
|
||||
@@ -411,8 +411,11 @@ static int make_deprecated_class_device_links(struct class_device *class_dev)
|
||||
return 0;
|
||||
|
||||
class_name = make_class_name(class_dev->class->name, &class_dev->kobj);
|
||||
error = sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,
|
||||
class_name);
|
||||
if (class_name)
|
||||
error = sysfs_create_link(&class_dev->dev->kobj,
|
||||
&class_dev->kobj, class_name);
|
||||
else
|
||||
error = -ENOMEM;
|
||||
kfree(class_name);
|
||||
return error;
|
||||
}
|
||||
@@ -425,7 +428,8 @@ static void remove_deprecated_class_device_links(struct class_device *class_dev)
|
||||
return;
|
||||
|
||||
class_name = make_class_name(class_dev->class->name, &class_dev->kobj);
|
||||
sysfs_remove_link(&class_dev->dev->kobj, class_name);
|
||||
if (class_name)
|
||||
sysfs_remove_link(&class_dev->dev->kobj, class_name);
|
||||
kfree(class_name);
|
||||
}
|
||||
#else
|
||||
@@ -863,9 +867,12 @@ int class_device_rename(struct class_device *class_dev, char *new_name)
|
||||
if (class_dev->dev) {
|
||||
new_class_name = make_class_name(class_dev->class->name,
|
||||
&class_dev->kobj);
|
||||
sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,
|
||||
new_class_name);
|
||||
sysfs_remove_link(&class_dev->dev->kobj, old_class_name);
|
||||
if (new_class_name)
|
||||
sysfs_create_link(&class_dev->dev->kobj,
|
||||
&class_dev->kobj, new_class_name);
|
||||
if (old_class_name)
|
||||
sysfs_remove_link(&class_dev->dev->kobj,
|
||||
old_class_name);
|
||||
}
|
||||
#endif
|
||||
class_device_put(class_dev);
|
||||
|
||||
+133
-70
@@ -95,6 +95,8 @@ static void device_release(struct kobject * kobj)
|
||||
|
||||
if (dev->release)
|
||||
dev->release(dev);
|
||||
else if (dev->type && dev->type->release)
|
||||
dev->type->release(dev);
|
||||
else if (dev->class && dev->class->dev_release)
|
||||
dev->class->dev_release(dev);
|
||||
else {
|
||||
@@ -154,25 +156,47 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp,
|
||||
"MINOR=%u", MINOR(dev->devt));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSFS_DEPRECATED
|
||||
/* add bus name (same as SUBSYSTEM, deprecated) */
|
||||
if (dev->bus)
|
||||
add_uevent_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PHYSDEVBUS=%s", dev->bus->name);
|
||||
#endif
|
||||
|
||||
/* add driver name (PHYSDEV* values are deprecated)*/
|
||||
if (dev->driver) {
|
||||
if (dev->driver)
|
||||
add_uevent_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"DRIVER=%s", dev->driver->name);
|
||||
|
||||
#ifdef CONFIG_SYSFS_DEPRECATED
|
||||
if (dev->class) {
|
||||
struct device *parent = dev->parent;
|
||||
|
||||
/* find first bus device in parent chain */
|
||||
while (parent && !parent->bus)
|
||||
parent = parent->parent;
|
||||
if (parent && parent->bus) {
|
||||
const char *path;
|
||||
|
||||
path = kobject_get_path(&parent->kobj, GFP_KERNEL);
|
||||
add_uevent_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PHYSDEVPATH=%s", path);
|
||||
kfree(path);
|
||||
|
||||
add_uevent_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PHYSDEVBUS=%s", parent->bus->name);
|
||||
|
||||
if (parent->driver)
|
||||
add_uevent_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PHYSDEVDRIVER=%s", parent->driver->name);
|
||||
}
|
||||
} else if (dev->bus) {
|
||||
add_uevent_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PHYSDEVDRIVER=%s", dev->driver->name);
|
||||
#endif
|
||||
"PHYSDEVBUS=%s", dev->bus->name);
|
||||
|
||||
if (dev->driver)
|
||||
add_uevent_var(envp, num_envp, &i,
|
||||
buffer, buffer_size, &length,
|
||||
"PHYSDEVDRIVER=%s", dev->driver->name);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* terminate, set to next free slot, shrink available space */
|
||||
envp[i] = NULL;
|
||||
@@ -184,19 +208,25 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp,
|
||||
if (dev->bus && dev->bus->uevent) {
|
||||
/* have the bus specific function add its stuff */
|
||||
retval = dev->bus->uevent(dev, envp, num_envp, buffer, buffer_size);
|
||||
if (retval) {
|
||||
pr_debug ("%s - uevent() returned %d\n",
|
||||
if (retval)
|
||||
pr_debug ("%s: bus uevent() returned %d\n",
|
||||
__FUNCTION__, retval);
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->class && dev->class->dev_uevent) {
|
||||
/* have the class specific function add its stuff */
|
||||
retval = dev->class->dev_uevent(dev, envp, num_envp, buffer, buffer_size);
|
||||
if (retval) {
|
||||
pr_debug("%s - dev_uevent() returned %d\n",
|
||||
__FUNCTION__, retval);
|
||||
}
|
||||
if (retval)
|
||||
pr_debug("%s: class uevent() returned %d\n",
|
||||
__FUNCTION__, retval);
|
||||
}
|
||||
|
||||
if (dev->type && dev->type->uevent) {
|
||||
/* have the device type specific fuction add its stuff */
|
||||
retval = dev->type->uevent(dev, envp, num_envp, buffer, buffer_size);
|
||||
if (retval)
|
||||
pr_debug("%s: dev_type uevent() returned %d\n",
|
||||
__FUNCTION__, retval);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -247,37 +277,50 @@ static void device_remove_groups(struct device *dev)
|
||||
static int device_add_attrs(struct device *dev)
|
||||
{
|
||||
struct class *class = dev->class;
|
||||
struct device_type *type = dev->type;
|
||||
int error = 0;
|
||||
int i;
|
||||
|
||||
if (!class)
|
||||
return 0;
|
||||
|
||||
if (class->dev_attrs) {
|
||||
if (class && class->dev_attrs) {
|
||||
for (i = 0; attr_name(class->dev_attrs[i]); i++) {
|
||||
error = device_create_file(dev, &class->dev_attrs[i]);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
if (error)
|
||||
while (--i >= 0)
|
||||
device_remove_file(dev, &class->dev_attrs[i]);
|
||||
}
|
||||
if (error)
|
||||
while (--i >= 0)
|
||||
device_remove_file(dev, &class->dev_attrs[i]);
|
||||
|
||||
if (type && type->attrs) {
|
||||
for (i = 0; attr_name(type->attrs[i]); i++) {
|
||||
error = device_create_file(dev, &type->attrs[i]);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
if (error)
|
||||
while (--i >= 0)
|
||||
device_remove_file(dev, &type->attrs[i]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void device_remove_attrs(struct device *dev)
|
||||
{
|
||||
struct class *class = dev->class;
|
||||
struct device_type *type = dev->type;
|
||||
int i;
|
||||
|
||||
if (!class)
|
||||
return;
|
||||
|
||||
if (class->dev_attrs) {
|
||||
if (class && class->dev_attrs) {
|
||||
for (i = 0; attr_name(class->dev_attrs[i]); i++)
|
||||
device_remove_file(dev, &class->dev_attrs[i]);
|
||||
}
|
||||
|
||||
if (type && type->attrs) {
|
||||
for (i = 0; attr_name(type->attrs[i]); i++)
|
||||
device_remove_file(dev, &type->attrs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -390,22 +433,23 @@ void device_initialize(struct device *dev)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSFS_DEPRECATED
|
||||
static int setup_parent(struct device *dev, struct device *parent)
|
||||
static struct kobject * get_device_parent(struct device *dev,
|
||||
struct device *parent)
|
||||
{
|
||||
/* Set the parent to the class, not the parent device */
|
||||
/* this keeps sysfs from having a symlink to make old udevs happy */
|
||||
if (dev->class)
|
||||
dev->kobj.parent = &dev->class->subsys.kset.kobj;
|
||||
return &dev->class->subsys.kset.kobj;
|
||||
else if (parent)
|
||||
dev->kobj.parent = &parent->kobj;
|
||||
return &parent->kobj;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
static int virtual_device_parent(struct device *dev)
|
||||
static struct kobject * virtual_device_parent(struct device *dev)
|
||||
{
|
||||
if (!dev->class)
|
||||
return -ENODEV;
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
||||
if (!dev->class->virtual_dir) {
|
||||
static struct kobject *virtual_dir = NULL;
|
||||
@@ -415,25 +459,31 @@ static int virtual_device_parent(struct device *dev)
|
||||
dev->class->virtual_dir = kobject_add_dir(virtual_dir, dev->class->name);
|
||||
}
|
||||
|
||||
dev->kobj.parent = dev->class->virtual_dir;
|
||||
return 0;
|
||||
return dev->class->virtual_dir;
|
||||
}
|
||||
|
||||
static int setup_parent(struct device *dev, struct device *parent)
|
||||
static struct kobject * get_device_parent(struct device *dev,
|
||||
struct device *parent)
|
||||
{
|
||||
int error;
|
||||
|
||||
/* if this is a class device, and has no parent, create one */
|
||||
if ((dev->class) && (parent == NULL)) {
|
||||
error = virtual_device_parent(dev);
|
||||
if (error)
|
||||
return error;
|
||||
return virtual_device_parent(dev);
|
||||
} else if (parent)
|
||||
dev->kobj.parent = &parent->kobj;
|
||||
return &parent->kobj;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
static int setup_parent(struct device *dev, struct device *parent)
|
||||
{
|
||||
struct kobject *kobj;
|
||||
kobj = get_device_parent(dev, parent);
|
||||
if (IS_ERR(kobj))
|
||||
return PTR_ERR(kobj);
|
||||
if (kobj)
|
||||
dev->kobj.parent = kobj;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* device_add - add device to device hierarchy.
|
||||
@@ -520,9 +570,13 @@ int device_add(struct device *dev)
|
||||
&dev->kobj, dev->bus_id);
|
||||
#ifdef CONFIG_SYSFS_DEPRECATED
|
||||
if (parent) {
|
||||
sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device");
|
||||
class_name = make_class_name(dev->class->name, &dev->kobj);
|
||||
sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name);
|
||||
sysfs_create_link(&dev->kobj, &dev->parent->kobj,
|
||||
"device");
|
||||
class_name = make_class_name(dev->class->name,
|
||||
&dev->kobj);
|
||||
if (class_name)
|
||||
sysfs_create_link(&dev->parent->kobj,
|
||||
&dev->kobj, class_name);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -535,7 +589,8 @@ int device_add(struct device *dev)
|
||||
goto PMError;
|
||||
if ((error = bus_add_device(dev)))
|
||||
goto BusError;
|
||||
kobject_uevent(&dev->kobj, KOBJ_ADD);
|
||||
if (!dev->uevent_suppress)
|
||||
kobject_uevent(&dev->kobj, KOBJ_ADD);
|
||||
if ((error = bus_attach_device(dev)))
|
||||
goto AttachError;
|
||||
if (parent)
|
||||
@@ -665,7 +720,9 @@ void device_del(struct device * dev)
|
||||
if (parent) {
|
||||
char *class_name = make_class_name(dev->class->name,
|
||||
&dev->kobj);
|
||||
sysfs_remove_link(&dev->parent->kobj, class_name);
|
||||
if (class_name)
|
||||
sysfs_remove_link(&dev->parent->kobj,
|
||||
class_name);
|
||||
kfree(class_name);
|
||||
sysfs_remove_link(&dev->kobj, "device");
|
||||
}
|
||||
@@ -968,20 +1025,25 @@ static int device_move_class_links(struct device *dev,
|
||||
|
||||
class_name = make_class_name(dev->class->name, &dev->kobj);
|
||||
if (!class_name) {
|
||||
error = PTR_ERR(class_name);
|
||||
class_name = NULL;
|
||||
error = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
if (old_parent) {
|
||||
sysfs_remove_link(&dev->kobj, "device");
|
||||
sysfs_remove_link(&old_parent->kobj, class_name);
|
||||
}
|
||||
error = sysfs_create_link(&dev->kobj, &new_parent->kobj, "device");
|
||||
if (error)
|
||||
goto out;
|
||||
error = sysfs_create_link(&new_parent->kobj, &dev->kobj, class_name);
|
||||
if (error)
|
||||
sysfs_remove_link(&dev->kobj, "device");
|
||||
if (new_parent) {
|
||||
error = sysfs_create_link(&dev->kobj, &new_parent->kobj,
|
||||
"device");
|
||||
if (error)
|
||||
goto out;
|
||||
error = sysfs_create_link(&new_parent->kobj, &dev->kobj,
|
||||
class_name);
|
||||
if (error)
|
||||
sysfs_remove_link(&dev->kobj, "device");
|
||||
}
|
||||
else
|
||||
error = 0;
|
||||
out:
|
||||
kfree(class_name);
|
||||
return error;
|
||||
@@ -993,29 +1055,28 @@ out:
|
||||
/**
|
||||
* device_move - moves a device to a new parent
|
||||
* @dev: the pointer to the struct device to be moved
|
||||
* @new_parent: the new parent of the device
|
||||
* @new_parent: the new parent of the device (can by NULL)
|
||||
*/
|
||||
int device_move(struct device *dev, struct device *new_parent)
|
||||
{
|
||||
int error;
|
||||
struct device *old_parent;
|
||||
struct kobject *new_parent_kobj;
|
||||
|
||||
dev = get_device(dev);
|
||||
if (!dev)
|
||||
return -EINVAL;
|
||||
|
||||
if (!device_is_registered(dev)) {
|
||||
error = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
new_parent = get_device(new_parent);
|
||||
if (!new_parent) {
|
||||
error = -EINVAL;
|
||||
new_parent_kobj = get_device_parent (dev, new_parent);
|
||||
if (IS_ERR(new_parent_kobj)) {
|
||||
error = PTR_ERR(new_parent_kobj);
|
||||
put_device(new_parent);
|
||||
goto out;
|
||||
}
|
||||
pr_debug("DEVICE: moving '%s' to '%s'\n", dev->bus_id,
|
||||
new_parent->bus_id);
|
||||
error = kobject_move(&dev->kobj, &new_parent->kobj);
|
||||
new_parent ? new_parent->bus_id : "<NULL>");
|
||||
error = kobject_move(&dev->kobj, new_parent_kobj);
|
||||
if (error) {
|
||||
put_device(new_parent);
|
||||
goto out;
|
||||
@@ -1024,7 +1085,8 @@ int device_move(struct device *dev, struct device *new_parent)
|
||||
dev->parent = new_parent;
|
||||
if (old_parent)
|
||||
klist_remove(&dev->knode_parent);
|
||||
klist_add_tail(&dev->knode_parent, &new_parent->klist_children);
|
||||
if (new_parent)
|
||||
klist_add_tail(&dev->knode_parent, &new_parent->klist_children);
|
||||
if (!dev->class)
|
||||
goto out_put;
|
||||
error = device_move_class_links(dev, old_parent, new_parent);
|
||||
@@ -1032,7 +1094,8 @@ int device_move(struct device *dev, struct device *new_parent)
|
||||
/* We ignore errors on cleanup since we're hosed anyway... */
|
||||
device_move_class_links(dev, new_parent, old_parent);
|
||||
if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
|
||||
klist_remove(&dev->knode_parent);
|
||||
if (new_parent)
|
||||
klist_remove(&dev->knode_parent);
|
||||
if (old_parent)
|
||||
klist_add_tail(&dev->knode_parent,
|
||||
&old_parent->klist_children);
|
||||
|
||||
+12
-9
@@ -86,8 +86,12 @@ static void driver_sysfs_remove(struct device *dev)
|
||||
*/
|
||||
int device_bind_driver(struct device *dev)
|
||||
{
|
||||
driver_bound(dev);
|
||||
return driver_sysfs_add(dev);
|
||||
int ret;
|
||||
|
||||
ret = driver_sysfs_add(dev);
|
||||
if (!ret)
|
||||
driver_bound(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct stupid_thread_structure {
|
||||
@@ -136,18 +140,17 @@ probe_failed:
|
||||
driver_sysfs_remove(dev);
|
||||
dev->driver = NULL;
|
||||
|
||||
if (ret == -ENODEV || ret == -ENXIO) {
|
||||
/* Driver matched, but didn't support device
|
||||
* or device not found.
|
||||
* Not an error; keep going.
|
||||
*/
|
||||
ret = 0;
|
||||
} else {
|
||||
if (ret != -ENODEV && ret != -ENXIO) {
|
||||
/* driver matched but the probe failed */
|
||||
printk(KERN_WARNING
|
||||
"%s: probe of %s failed with error %d\n",
|
||||
drv->name, dev->bus_id, ret);
|
||||
}
|
||||
/*
|
||||
* Ignore errors returned by ->probe so that the next driver can try
|
||||
* its luck.
|
||||
*/
|
||||
ret = 0;
|
||||
done:
|
||||
kfree(data);
|
||||
atomic_dec(&probe_count);
|
||||
|
||||
@@ -35,7 +35,7 @@ enum {
|
||||
FW_STATUS_READY_NOHOTPLUG,
|
||||
};
|
||||
|
||||
static int loading_timeout = 10; /* In seconds */
|
||||
static int loading_timeout = 60; /* In seconds */
|
||||
|
||||
/* fw_lock could be moved to 'struct firmware_priv' but since it is just
|
||||
* guarding for corner cases a global lock should be OK */
|
||||
|
||||
@@ -611,8 +611,15 @@ EXPORT_SYMBOL_GPL(platform_bus_type);
|
||||
|
||||
int __init platform_bus_init(void)
|
||||
{
|
||||
device_register(&platform_bus);
|
||||
return bus_register(&platform_bus_type);
|
||||
int error;
|
||||
|
||||
error = device_register(&platform_bus);
|
||||
if (error)
|
||||
return error;
|
||||
error = bus_register(&platform_bus_type);
|
||||
if (error)
|
||||
device_unregister(&platform_bus);
|
||||
return error;
|
||||
}
|
||||
|
||||
#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK
|
||||
|
||||
@@ -783,10 +783,11 @@ static LIST_HEAD(ide_pci_drivers);
|
||||
* Returns are the same as for pci_register_driver
|
||||
*/
|
||||
|
||||
int __ide_pci_register_driver(struct pci_driver *driver, struct module *module)
|
||||
int __ide_pci_register_driver(struct pci_driver *driver, struct module *module,
|
||||
const char *mod_name)
|
||||
{
|
||||
if(!pre_init)
|
||||
return __pci_register_driver(driver, module);
|
||||
return __pci_register_driver(driver, module, mod_name);
|
||||
driver->driver.owner = module;
|
||||
list_add_tail(&driver->node, &ide_pci_drivers);
|
||||
return 0;
|
||||
@@ -862,6 +863,6 @@ void __init ide_scan_pcibus (int scan_direction)
|
||||
{
|
||||
list_del(l);
|
||||
d = list_entry(l, struct pci_driver, node);
|
||||
__pci_register_driver(d, d->driver.owner);
|
||||
__pci_register_driver(d, d->driver.owner, d->driver.mod_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,16 +958,17 @@ struct ipoib_dev_priv *ipoib_intf_alloc(const char *name)
|
||||
return netdev_priv(dev);
|
||||
}
|
||||
|
||||
static ssize_t show_pkey(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_pkey(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct ipoib_dev_priv *priv =
|
||||
netdev_priv(container_of(cdev, struct net_device, class_dev));
|
||||
struct ipoib_dev_priv *priv = netdev_priv(to_net_dev(dev));
|
||||
|
||||
return sprintf(buf, "0x%04x\n", priv->pkey);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
|
||||
static DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
|
||||
|
||||
static ssize_t create_child(struct class_device *cdev,
|
||||
static ssize_t create_child(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int pkey;
|
||||
@@ -985,14 +986,14 @@ static ssize_t create_child(struct class_device *cdev,
|
||||
*/
|
||||
pkey |= 0x8000;
|
||||
|
||||
ret = ipoib_vlan_add(container_of(cdev, struct net_device, class_dev),
|
||||
pkey);
|
||||
ret = ipoib_vlan_add(to_net_dev(dev), pkey);
|
||||
|
||||
return ret ? ret : count;
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(create_child, S_IWUGO, NULL, create_child);
|
||||
static DEVICE_ATTR(create_child, S_IWUGO, NULL, create_child);
|
||||
|
||||
static ssize_t delete_child(struct class_device *cdev,
|
||||
static ssize_t delete_child(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int pkey;
|
||||
@@ -1004,18 +1005,16 @@ static ssize_t delete_child(struct class_device *cdev,
|
||||
if (pkey < 0 || pkey > 0xffff)
|
||||
return -EINVAL;
|
||||
|
||||
ret = ipoib_vlan_delete(container_of(cdev, struct net_device, class_dev),
|
||||
pkey);
|
||||
ret = ipoib_vlan_delete(to_net_dev(dev), pkey);
|
||||
|
||||
return ret ? ret : count;
|
||||
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(delete_child, S_IWUGO, NULL, delete_child);
|
||||
static DEVICE_ATTR(delete_child, S_IWUGO, NULL, delete_child);
|
||||
|
||||
int ipoib_add_pkey_attr(struct net_device *dev)
|
||||
{
|
||||
return class_device_create_file(&dev->class_dev,
|
||||
&class_device_attr_pkey);
|
||||
return device_create_file(&dev->dev, &dev_attr_pkey);
|
||||
}
|
||||
|
||||
static struct net_device *ipoib_add_port(const char *format,
|
||||
@@ -1083,11 +1082,9 @@ static struct net_device *ipoib_add_port(const char *format,
|
||||
|
||||
if (ipoib_add_pkey_attr(priv->dev))
|
||||
goto sysfs_failed;
|
||||
if (class_device_create_file(&priv->dev->class_dev,
|
||||
&class_device_attr_create_child))
|
||||
if (device_create_file(&priv->dev->dev, &dev_attr_create_child))
|
||||
goto sysfs_failed;
|
||||
if (class_device_create_file(&priv->dev->class_dev,
|
||||
&class_device_attr_delete_child))
|
||||
if (device_create_file(&priv->dev->dev, &dev_attr_delete_child))
|
||||
goto sysfs_failed;
|
||||
|
||||
return priv->dev;
|
||||
|
||||
@@ -42,15 +42,15 @@
|
||||
|
||||
#include "ipoib.h"
|
||||
|
||||
static ssize_t show_parent(struct class_device *class_dev, char *buf)
|
||||
static ssize_t show_parent(struct device *d, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct net_device *dev =
|
||||
container_of(class_dev, struct net_device, class_dev);
|
||||
struct net_device *dev = to_net_dev(d);
|
||||
struct ipoib_dev_priv *priv = netdev_priv(dev);
|
||||
|
||||
return sprintf(buf, "%s\n", priv->parent->name);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);
|
||||
static DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);
|
||||
|
||||
int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
|
||||
{
|
||||
@@ -118,8 +118,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
|
||||
if (ipoib_add_pkey_attr(priv->dev))
|
||||
goto sysfs_failed;
|
||||
|
||||
if (class_device_create_file(&priv->dev->class_dev,
|
||||
&class_device_attr_parent))
|
||||
if (device_create_file(&priv->dev->dev, &dev_attr_parent))
|
||||
goto sysfs_failed;
|
||||
|
||||
list_add_tail(&priv->list, &ppriv->child_intfs);
|
||||
|
||||
@@ -45,7 +45,7 @@ EXPORT_SYMBOL(serio_interrupt);
|
||||
EXPORT_SYMBOL(__serio_register_port);
|
||||
EXPORT_SYMBOL(serio_unregister_port);
|
||||
EXPORT_SYMBOL(serio_unregister_child_port);
|
||||
EXPORT_SYMBOL(serio_register_driver);
|
||||
EXPORT_SYMBOL(__serio_register_driver);
|
||||
EXPORT_SYMBOL(serio_unregister_driver);
|
||||
EXPORT_SYMBOL(serio_open);
|
||||
EXPORT_SYMBOL(serio_close);
|
||||
@@ -789,12 +789,14 @@ static void serio_attach_driver(struct serio_driver *drv)
|
||||
drv->driver.name, error);
|
||||
}
|
||||
|
||||
int serio_register_driver(struct serio_driver *drv)
|
||||
int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name)
|
||||
{
|
||||
int manual_bind = drv->manual_bind;
|
||||
int error;
|
||||
|
||||
drv->driver.bus = &serio_bus;
|
||||
drv->driver.owner = owner;
|
||||
drv->driver.mod_name = mod_name;
|
||||
|
||||
/*
|
||||
* Temporarily disable automatic binding because probing
|
||||
|
||||
@@ -641,7 +641,7 @@ static void at91ether_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo
|
||||
{
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
strlcpy(info->bus_info, dev->class_dev.dev->bus_id, sizeof(info->bus_info));
|
||||
strlcpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static const struct ethtool_ops at91ether_ethtool_ops = {
|
||||
|
||||
@@ -587,7 +587,7 @@ static void etherh_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i
|
||||
{
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
strlcpy(info->bus_info, dev->class_dev.dev->bus_id,
|
||||
strlcpy(info->bus_info, dev->dev.parent->bus_id,
|
||||
sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
|
||||
+174
-113
File diff suppressed because it is too large
Load Diff
@@ -1102,7 +1102,7 @@ static struct net_device * __init veth_probe_one(int vlan,
|
||||
}
|
||||
|
||||
kobject_init(&port->kobject);
|
||||
port->kobject.parent = &dev->class_dev.kobj;
|
||||
port->kobject.parent = &dev->dev.kobj;
|
||||
port->kobject.ktype = &veth_port_ktype;
|
||||
kobject_set_name(&port->kobject, "veth_port");
|
||||
if (0 != kobject_add(&port->kobject))
|
||||
|
||||
+18
-18
@@ -27,8 +27,6 @@
|
||||
|
||||
#include "macb.h"
|
||||
|
||||
#define to_net_dev(class) container_of(class, struct net_device, class_dev)
|
||||
|
||||
#define RX_BUFFER_SIZE 128
|
||||
#define RX_RING_SIZE 512
|
||||
#define RX_RING_BYTES (sizeof(struct dma_desc) * RX_RING_SIZE)
|
||||
@@ -945,10 +943,10 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t macb_mii_show(const struct class_device *cd, char *buf,
|
||||
static ssize_t macb_mii_show(const struct device *_dev, char *buf,
|
||||
unsigned long addr)
|
||||
{
|
||||
struct net_device *dev = to_net_dev(cd);
|
||||
struct net_device *dev = to_net_dev(_dev);
|
||||
struct macb *bp = netdev_priv(dev);
|
||||
ssize_t ret = -EINVAL;
|
||||
|
||||
@@ -962,11 +960,13 @@ static ssize_t macb_mii_show(const struct class_device *cd, char *buf,
|
||||
}
|
||||
|
||||
#define MII_ENTRY(name, addr) \
|
||||
static ssize_t show_##name(struct class_device *cd, char *buf) \
|
||||
static ssize_t show_##name(struct device *_dev, \
|
||||
struct device_attribute *attr, \
|
||||
char *buf) \
|
||||
{ \
|
||||
return macb_mii_show(cd, buf, addr); \
|
||||
return macb_mii_show(_dev, buf, addr); \
|
||||
} \
|
||||
static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
|
||||
static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
|
||||
|
||||
MII_ENTRY(bmcr, MII_BMCR);
|
||||
MII_ENTRY(bmsr, MII_BMSR);
|
||||
@@ -977,13 +977,13 @@ MII_ENTRY(lpa, MII_LPA);
|
||||
MII_ENTRY(expansion, MII_EXPANSION);
|
||||
|
||||
static struct attribute *macb_mii_attrs[] = {
|
||||
&class_device_attr_bmcr.attr,
|
||||
&class_device_attr_bmsr.attr,
|
||||
&class_device_attr_physid1.attr,
|
||||
&class_device_attr_physid2.attr,
|
||||
&class_device_attr_advertise.attr,
|
||||
&class_device_attr_lpa.attr,
|
||||
&class_device_attr_expansion.attr,
|
||||
&dev_attr_bmcr.attr,
|
||||
&dev_attr_bmsr.attr,
|
||||
&dev_attr_physid1.attr,
|
||||
&dev_attr_physid2.attr,
|
||||
&dev_attr_advertise.attr,
|
||||
&dev_attr_lpa.attr,
|
||||
&dev_attr_expansion.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -994,17 +994,17 @@ static struct attribute_group macb_mii_group = {
|
||||
|
||||
static void macb_unregister_sysfs(struct net_device *net)
|
||||
{
|
||||
struct class_device *class_dev = &net->class_dev;
|
||||
struct device *_dev = &net->dev;
|
||||
|
||||
sysfs_remove_group(&class_dev->kobj, &macb_mii_group);
|
||||
sysfs_remove_group(&_dev->kobj, &macb_mii_group);
|
||||
}
|
||||
|
||||
static int macb_register_sysfs(struct net_device *net)
|
||||
{
|
||||
struct class_device *class_dev = &net->class_dev;
|
||||
struct device *_dev = &net->dev;
|
||||
int ret;
|
||||
|
||||
ret = sysfs_create_group(&class_dev->kobj, &macb_mii_group);
|
||||
ret = sysfs_create_group(&_dev->kobj, &macb_mii_group);
|
||||
if (ret)
|
||||
printk(KERN_WARNING
|
||||
"%s: sysfs mii attribute registration failed: %d\n",
|
||||
|
||||
@@ -1659,7 +1659,7 @@ smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
|
||||
{
|
||||
strncpy(info->driver, CARDNAME, sizeof(info->driver));
|
||||
strncpy(info->version, version, sizeof(info->version));
|
||||
strncpy(info->bus_info, dev->class_dev.dev->bus_id, sizeof(info->bus_info));
|
||||
strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int smc911x_ethtool_nwayreset(struct net_device *dev)
|
||||
|
||||
@@ -1712,7 +1712,7 @@ smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
|
||||
{
|
||||
strncpy(info->driver, CARDNAME, sizeof(info->driver));
|
||||
strncpy(info->version, version, sizeof(info->version));
|
||||
strncpy(info->bus_info, dev->class_dev.dev->bus_id, sizeof(info->bus_info));
|
||||
strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int smc_ethtool_nwayreset(struct net_device *dev)
|
||||
|
||||
@@ -84,7 +84,7 @@ struct net_device * hostap_add_interface(struct local_info *local,
|
||||
if (strchr(dev->name, '%'))
|
||||
ret = dev_alloc_name(dev, dev->name);
|
||||
|
||||
SET_NETDEV_DEV(dev, mdev->class_dev.dev);
|
||||
SET_NETDEV_DEV(dev, mdev->dev.parent);
|
||||
if (ret >= 0)
|
||||
ret = register_netdevice(dev);
|
||||
|
||||
|
||||
@@ -4293,8 +4293,8 @@ static void orinoco_get_drvinfo(struct net_device *dev,
|
||||
strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
|
||||
strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
|
||||
strncpy(info->fw_version, priv->fw_name, sizeof(info->fw_version) - 1);
|
||||
if (dev->class_dev.dev)
|
||||
strncpy(info->bus_info, dev->class_dev.dev->bus_id,
|
||||
if (dev->dev.parent)
|
||||
strncpy(info->bus_info, dev->dev.parent->bus_id,
|
||||
sizeof(info->bus_info) - 1);
|
||||
else
|
||||
snprintf(info->bus_info, sizeof(info->bus_info) - 1,
|
||||
|
||||
@@ -332,7 +332,7 @@ orinoco_cs_config(struct pcmcia_device *link)
|
||||
|
||||
/* Finally, report what we've done */
|
||||
printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "
|
||||
"0x%04x-0x%04x\n", dev->name, dev->class_dev.dev->bus_id,
|
||||
"0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id,
|
||||
link->irq.AssignedIRQ, link->io.BasePort1,
|
||||
link->io.BasePort1 + link->io.NumPorts1 - 1);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user