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 tag 'driver-core-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core / sysfs patches from Greg KH: "Here's the big driver core / sysfs update for 3.13-rc1. There's lots of dev_groups updates for different subsystems, as they all get slowly migrated over to the safe versions of the attribute groups (removing userspace races with the creation of the sysfs files.) Also in here are some kobject updates, devres expansions, and the first round of Tejun's sysfs reworking to enable it to be used by other subsystems as a backend for an in-kernel filesystem. All of these have been in linux-next for a while with no reported issues" * tag 'driver-core-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (83 commits) sysfs: rename sysfs_assoc_lock and explain what it's about sysfs: use generic_file_llseek() for sysfs_file_operations sysfs: return correct error code on unimplemented mmap() mdio_bus: convert bus code to use dev_groups device: Make dev_WARN/dev_WARN_ONCE print device as well as driver name sysfs: separate out dup filename warning into a separate function sysfs: move sysfs_hash_and_remove() to fs/sysfs/dir.c sysfs: remove unused sysfs_get_dentry() prototype sysfs: honor bin_attr.attr.ignore_lockdep sysfs: merge sysfs_elem_bin_attr into sysfs_elem_attr devres: restore zeroing behavior of devres_alloc() sysfs: fix sysfs_write_file for bin file input: gameport: convert bus code to use dev_groups input: serio: remove bus usage of dev_attrs input: serio: use DEVICE_ATTR_RO() i2o: convert bus code to use dev_groups memstick: convert bus code to use dev_groups tifm: convert bus code to use dev_groups virtio: convert bus code to use dev_groups ipack: convert bus code to use dev_groups ...
This commit is contained in:
@@ -91,7 +91,6 @@
|
||||
<title>The Filesystem for Exporting Kernel Objects</title>
|
||||
!Efs/sysfs/file.c
|
||||
!Efs/sysfs/symlink.c
|
||||
!Efs/sysfs/bin.c
|
||||
</chapter>
|
||||
|
||||
<chapter id="debugfs">
|
||||
|
||||
@@ -292,6 +292,7 @@ out:
|
||||
return rc;
|
||||
return count;
|
||||
}
|
||||
static BUS_ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe);
|
||||
|
||||
static ssize_t ibmebus_store_remove(struct bus_type *bus,
|
||||
const char *buf, size_t count)
|
||||
@@ -317,13 +318,14 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
static BUS_ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove);
|
||||
|
||||
|
||||
static struct bus_attribute ibmebus_bus_attrs[] = {
|
||||
__ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe),
|
||||
__ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove),
|
||||
__ATTR_NULL
|
||||
static struct attribute *ibmbus_bus_attrs[] = {
|
||||
&bus_attr_probe.attr,
|
||||
&bus_attr_remove.attr,
|
||||
NULL,
|
||||
};
|
||||
ATTRIBUTE_GROUPS(ibmbus_bus);
|
||||
|
||||
static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
|
||||
{
|
||||
@@ -713,7 +715,7 @@ static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
|
||||
struct bus_type ibmebus_bus_type = {
|
||||
.name = "ibmebus",
|
||||
.uevent = of_device_uevent_modalias,
|
||||
.bus_attrs = ibmebus_bus_attrs,
|
||||
.bus_groups = ibmbus_bus_groups,
|
||||
.match = ibmebus_bus_bus_match,
|
||||
.probe = ibmebus_bus_device_probe,
|
||||
.remove = ibmebus_bus_device_remove,
|
||||
|
||||
+35
-29
@@ -997,21 +997,36 @@ static struct device_attribute vio_cmo_dev_attrs[] = {
|
||||
/* sysfs bus functions and data structures for CMO */
|
||||
|
||||
#define viobus_cmo_rd_attr(name) \
|
||||
static ssize_t \
|
||||
viobus_cmo_##name##_show(struct bus_type *bt, char *buf) \
|
||||
static ssize_t cmo_##name##_show(struct bus_type *bt, char *buf) \
|
||||
{ \
|
||||
return sprintf(buf, "%lu\n", vio_cmo.name); \
|
||||
}
|
||||
} \
|
||||
static BUS_ATTR_RO(cmo_##name)
|
||||
|
||||
#define viobus_cmo_pool_rd_attr(name, var) \
|
||||
static ssize_t \
|
||||
viobus_cmo_##name##_pool_show_##var(struct bus_type *bt, char *buf) \
|
||||
cmo_##name##_##var##_show(struct bus_type *bt, char *buf) \
|
||||
{ \
|
||||
return sprintf(buf, "%lu\n", vio_cmo.name.var); \
|
||||
} \
|
||||
static BUS_ATTR_RO(cmo_##name##_##var)
|
||||
|
||||
viobus_cmo_rd_attr(entitled);
|
||||
viobus_cmo_rd_attr(spare);
|
||||
viobus_cmo_rd_attr(min);
|
||||
viobus_cmo_rd_attr(desired);
|
||||
viobus_cmo_rd_attr(curr);
|
||||
viobus_cmo_pool_rd_attr(reserve, size);
|
||||
viobus_cmo_pool_rd_attr(excess, size);
|
||||
viobus_cmo_pool_rd_attr(excess, free);
|
||||
|
||||
static ssize_t cmo_high_show(struct bus_type *bt, char *buf)
|
||||
{
|
||||
return sprintf(buf, "%lu\n", vio_cmo.high);
|
||||
}
|
||||
|
||||
static ssize_t viobus_cmo_high_reset(struct bus_type *bt, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t cmo_high_store(struct bus_type *bt, const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
@@ -1021,35 +1036,26 @@ static ssize_t viobus_cmo_high_reset(struct bus_type *bt, const char *buf,
|
||||
|
||||
return count;
|
||||
}
|
||||
static BUS_ATTR_RW(cmo_high);
|
||||
|
||||
viobus_cmo_rd_attr(entitled);
|
||||
viobus_cmo_pool_rd_attr(reserve, size);
|
||||
viobus_cmo_pool_rd_attr(excess, size);
|
||||
viobus_cmo_pool_rd_attr(excess, free);
|
||||
viobus_cmo_rd_attr(spare);
|
||||
viobus_cmo_rd_attr(min);
|
||||
viobus_cmo_rd_attr(desired);
|
||||
viobus_cmo_rd_attr(curr);
|
||||
viobus_cmo_rd_attr(high);
|
||||
|
||||
static struct bus_attribute vio_cmo_bus_attrs[] = {
|
||||
__ATTR(cmo_entitled, S_IRUGO, viobus_cmo_entitled_show, NULL),
|
||||
__ATTR(cmo_reserve_size, S_IRUGO, viobus_cmo_reserve_pool_show_size, NULL),
|
||||
__ATTR(cmo_excess_size, S_IRUGO, viobus_cmo_excess_pool_show_size, NULL),
|
||||
__ATTR(cmo_excess_free, S_IRUGO, viobus_cmo_excess_pool_show_free, NULL),
|
||||
__ATTR(cmo_spare, S_IRUGO, viobus_cmo_spare_show, NULL),
|
||||
__ATTR(cmo_min, S_IRUGO, viobus_cmo_min_show, NULL),
|
||||
__ATTR(cmo_desired, S_IRUGO, viobus_cmo_desired_show, NULL),
|
||||
__ATTR(cmo_curr, S_IRUGO, viobus_cmo_curr_show, NULL),
|
||||
__ATTR(cmo_high, S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
|
||||
viobus_cmo_high_show, viobus_cmo_high_reset),
|
||||
__ATTR_NULL
|
||||
static struct attribute *vio_bus_attrs[] = {
|
||||
&bus_attr_cmo_entitled.attr,
|
||||
&bus_attr_cmo_spare.attr,
|
||||
&bus_attr_cmo_min.attr,
|
||||
&bus_attr_cmo_desired.attr,
|
||||
&bus_attr_cmo_curr.attr,
|
||||
&bus_attr_cmo_high.attr,
|
||||
&bus_attr_cmo_reserve_size.attr,
|
||||
&bus_attr_cmo_excess_size.attr,
|
||||
&bus_attr_cmo_excess_free.attr,
|
||||
NULL,
|
||||
};
|
||||
ATTRIBUTE_GROUPS(vio_bus);
|
||||
|
||||
static void vio_cmo_sysfs_init(void)
|
||||
{
|
||||
vio_bus_type.dev_attrs = vio_cmo_dev_attrs;
|
||||
vio_bus_type.bus_attrs = vio_cmo_bus_attrs;
|
||||
vio_bus_type.bus_groups = vio_bus_groups;
|
||||
}
|
||||
#else /* CONFIG_PPC_SMLPAR */
|
||||
int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
|
||||
|
||||
+2
-80
@@ -591,37 +591,6 @@ void bus_remove_device(struct device *dev)
|
||||
bus_put(dev->bus);
|
||||
}
|
||||
|
||||
static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv)
|
||||
{
|
||||
int error = 0;
|
||||
int i;
|
||||
|
||||
if (bus->drv_attrs) {
|
||||
for (i = 0; bus->drv_attrs[i].attr.name; i++) {
|
||||
error = driver_create_file(drv, &bus->drv_attrs[i]);
|
||||
if (error)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
done:
|
||||
return error;
|
||||
err:
|
||||
while (--i >= 0)
|
||||
driver_remove_file(drv, &bus->drv_attrs[i]);
|
||||
goto done;
|
||||
}
|
||||
|
||||
static void driver_remove_attrs(struct bus_type *bus,
|
||||
struct device_driver *drv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (bus->drv_attrs) {
|
||||
for (i = 0; bus->drv_attrs[i].attr.name; i++)
|
||||
driver_remove_file(drv, &bus->drv_attrs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static int __must_check add_bind_files(struct device_driver *drv)
|
||||
{
|
||||
int ret;
|
||||
@@ -720,16 +689,12 @@ int bus_add_driver(struct device_driver *drv)
|
||||
printk(KERN_ERR "%s: uevent attr (%s) failed\n",
|
||||
__func__, drv->name);
|
||||
}
|
||||
error = driver_add_attrs(bus, drv);
|
||||
error = driver_add_groups(drv, bus->drv_groups);
|
||||
if (error) {
|
||||
/* How the hell do we get out of this pickle? Give up */
|
||||
printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
|
||||
__func__, drv->name);
|
||||
}
|
||||
error = driver_add_groups(drv, bus->drv_groups);
|
||||
if (error)
|
||||
printk(KERN_ERR "%s: driver_create_groups(%s) failed\n",
|
||||
__func__, drv->name);
|
||||
}
|
||||
|
||||
if (!drv->suppress_bind_attrs) {
|
||||
error = add_bind_files(drv);
|
||||
@@ -766,7 +731,6 @@ void bus_remove_driver(struct device_driver *drv)
|
||||
|
||||
if (!drv->suppress_bind_attrs)
|
||||
remove_bind_files(drv);
|
||||
driver_remove_attrs(drv->bus, drv);
|
||||
driver_remove_groups(drv, drv->bus->drv_groups);
|
||||
driver_remove_file(drv, &driver_attr_uevent);
|
||||
klist_remove(&drv->p->knode_bus);
|
||||
@@ -846,42 +810,6 @@ struct bus_type *find_bus(char *name)
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
|
||||
/**
|
||||
* bus_add_attrs - Add default attributes for this bus.
|
||||
* @bus: Bus that has just been registered.
|
||||
*/
|
||||
|
||||
static int bus_add_attrs(struct bus_type *bus)
|
||||
{
|
||||
int error = 0;
|
||||
int i;
|
||||
|
||||
if (bus->bus_attrs) {
|
||||
for (i = 0; bus->bus_attrs[i].attr.name; i++) {
|
||||
error = bus_create_file(bus, &bus->bus_attrs[i]);
|
||||
if (error)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
done:
|
||||
return error;
|
||||
err:
|
||||
while (--i >= 0)
|
||||
bus_remove_file(bus, &bus->bus_attrs[i]);
|
||||
goto done;
|
||||
}
|
||||
|
||||
static void bus_remove_attrs(struct bus_type *bus)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (bus->bus_attrs) {
|
||||
for (i = 0; bus->bus_attrs[i].attr.name; i++)
|
||||
bus_remove_file(bus, &bus->bus_attrs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static int bus_add_groups(struct bus_type *bus,
|
||||
const struct attribute_group **groups)
|
||||
{
|
||||
@@ -983,9 +911,6 @@ int bus_register(struct bus_type *bus)
|
||||
if (retval)
|
||||
goto bus_probe_files_fail;
|
||||
|
||||
retval = bus_add_attrs(bus);
|
||||
if (retval)
|
||||
goto bus_attrs_fail;
|
||||
retval = bus_add_groups(bus, bus->bus_groups);
|
||||
if (retval)
|
||||
goto bus_groups_fail;
|
||||
@@ -994,8 +919,6 @@ int bus_register(struct bus_type *bus)
|
||||
return 0;
|
||||
|
||||
bus_groups_fail:
|
||||
bus_remove_attrs(bus);
|
||||
bus_attrs_fail:
|
||||
remove_probe_files(bus);
|
||||
bus_probe_files_fail:
|
||||
kset_unregister(bus->p->drivers_kset);
|
||||
@@ -1024,7 +947,6 @@ void bus_unregister(struct bus_type *bus)
|
||||
pr_debug("bus: '%s': unregistering\n", bus->name);
|
||||
if (bus->dev_root)
|
||||
device_unregister(bus->dev_root);
|
||||
bus_remove_attrs(bus);
|
||||
bus_remove_groups(bus, bus->bus_groups);
|
||||
remove_probe_files(bus);
|
||||
kset_unregister(bus->p->drivers_kset);
|
||||
|
||||
+9
-20
@@ -47,18 +47,6 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const void *class_attr_namespace(struct kobject *kobj,
|
||||
const struct attribute *attr)
|
||||
{
|
||||
struct class_attribute *class_attr = to_class_attr(attr);
|
||||
struct subsys_private *cp = to_subsys_private(kobj);
|
||||
const void *ns = NULL;
|
||||
|
||||
if (class_attr->namespace)
|
||||
ns = class_attr->namespace(cp->class, class_attr);
|
||||
return ns;
|
||||
}
|
||||
|
||||
static void class_release(struct kobject *kobj)
|
||||
{
|
||||
struct subsys_private *cp = to_subsys_private(kobj);
|
||||
@@ -86,7 +74,6 @@ static const struct kobj_ns_type_operations *class_child_ns_type(struct kobject
|
||||
static const struct sysfs_ops class_sysfs_ops = {
|
||||
.show = class_attr_show,
|
||||
.store = class_attr_store,
|
||||
.namespace = class_attr_namespace,
|
||||
};
|
||||
|
||||
static struct kobj_type class_ktype = {
|
||||
@@ -99,21 +86,23 @@ static struct kobj_type class_ktype = {
|
||||
static struct kset *class_kset;
|
||||
|
||||
|
||||
int class_create_file(struct class *cls, const struct class_attribute *attr)
|
||||
int class_create_file_ns(struct class *cls, const struct class_attribute *attr,
|
||||
const void *ns)
|
||||
{
|
||||
int error;
|
||||
if (cls)
|
||||
error = sysfs_create_file(&cls->p->subsys.kobj,
|
||||
&attr->attr);
|
||||
error = sysfs_create_file_ns(&cls->p->subsys.kobj,
|
||||
&attr->attr, ns);
|
||||
else
|
||||
error = -EINVAL;
|
||||
return error;
|
||||
}
|
||||
|
||||
void class_remove_file(struct class *cls, const struct class_attribute *attr)
|
||||
void class_remove_file_ns(struct class *cls, const struct class_attribute *attr,
|
||||
const void *ns)
|
||||
{
|
||||
if (cls)
|
||||
sysfs_remove_file(&cls->p->subsys.kobj, &attr->attr);
|
||||
sysfs_remove_file_ns(&cls->p->subsys.kobj, &attr->attr, ns);
|
||||
}
|
||||
|
||||
static struct class *class_get(struct class *cls)
|
||||
@@ -600,8 +589,8 @@ int __init classes_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(class_create_file);
|
||||
EXPORT_SYMBOL_GPL(class_remove_file);
|
||||
EXPORT_SYMBOL_GPL(class_create_file_ns);
|
||||
EXPORT_SYMBOL_GPL(class_remove_file_ns);
|
||||
EXPORT_SYMBOL_GPL(class_unregister);
|
||||
EXPORT_SYMBOL_GPL(class_destroy);
|
||||
|
||||
|
||||
+8
-80
@@ -455,64 +455,6 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr,
|
||||
}
|
||||
static DEVICE_ATTR_RW(online);
|
||||
|
||||
static int device_add_attributes(struct device *dev,
|
||||
struct device_attribute *attrs)
|
||||
{
|
||||
int error = 0;
|
||||
int i;
|
||||
|
||||
if (attrs) {
|
||||
for (i = 0; attrs[i].attr.name; i++) {
|
||||
error = device_create_file(dev, &attrs[i]);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
if (error)
|
||||
while (--i >= 0)
|
||||
device_remove_file(dev, &attrs[i]);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
static void device_remove_attributes(struct device *dev,
|
||||
struct device_attribute *attrs)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (attrs)
|
||||
for (i = 0; attrs[i].attr.name; i++)
|
||||
device_remove_file(dev, &attrs[i]);
|
||||
}
|
||||
|
||||
static int device_add_bin_attributes(struct device *dev,
|
||||
struct bin_attribute *attrs)
|
||||
{
|
||||
int error = 0;
|
||||
int i;
|
||||
|
||||
if (attrs) {
|
||||
for (i = 0; attrs[i].attr.name; i++) {
|
||||
error = device_create_bin_file(dev, &attrs[i]);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
if (error)
|
||||
while (--i >= 0)
|
||||
device_remove_bin_file(dev, &attrs[i]);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
static void device_remove_bin_attributes(struct device *dev,
|
||||
struct bin_attribute *attrs)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (attrs)
|
||||
for (i = 0; attrs[i].attr.name; i++)
|
||||
device_remove_bin_file(dev, &attrs[i]);
|
||||
}
|
||||
|
||||
int device_add_groups(struct device *dev, const struct attribute_group **groups)
|
||||
{
|
||||
return sysfs_create_groups(&dev->kobj, groups);
|
||||
@@ -534,18 +476,12 @@ static int device_add_attrs(struct device *dev)
|
||||
error = device_add_groups(dev, class->dev_groups);
|
||||
if (error)
|
||||
return error;
|
||||
error = device_add_attributes(dev, class->dev_attrs);
|
||||
if (error)
|
||||
goto err_remove_class_groups;
|
||||
error = device_add_bin_attributes(dev, class->dev_bin_attrs);
|
||||
if (error)
|
||||
goto err_remove_class_attrs;
|
||||
}
|
||||
|
||||
if (type) {
|
||||
error = device_add_groups(dev, type->groups);
|
||||
if (error)
|
||||
goto err_remove_class_bin_attrs;
|
||||
goto err_remove_class_groups;
|
||||
}
|
||||
|
||||
error = device_add_groups(dev, dev->groups);
|
||||
@@ -563,12 +499,6 @@ static int device_add_attrs(struct device *dev)
|
||||
err_remove_type_groups:
|
||||
if (type)
|
||||
device_remove_groups(dev, type->groups);
|
||||
err_remove_class_bin_attrs:
|
||||
if (class)
|
||||
device_remove_bin_attributes(dev, class->dev_bin_attrs);
|
||||
err_remove_class_attrs:
|
||||
if (class)
|
||||
device_remove_attributes(dev, class->dev_attrs);
|
||||
err_remove_class_groups:
|
||||
if (class)
|
||||
device_remove_groups(dev, class->dev_groups);
|
||||
@@ -587,11 +517,8 @@ static void device_remove_attrs(struct device *dev)
|
||||
if (type)
|
||||
device_remove_groups(dev, type->groups);
|
||||
|
||||
if (class) {
|
||||
device_remove_attributes(dev, class->dev_attrs);
|
||||
device_remove_bin_attributes(dev, class->dev_bin_attrs);
|
||||
if (class)
|
||||
device_remove_groups(dev, class->dev_groups);
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t dev_show(struct device *dev, struct device_attribute *attr,
|
||||
@@ -1881,6 +1808,7 @@ EXPORT_SYMBOL_GPL(device_destroy);
|
||||
*/
|
||||
int device_rename(struct device *dev, const char *new_name)
|
||||
{
|
||||
struct kobject *kobj = &dev->kobj;
|
||||
char *old_device_name = NULL;
|
||||
int error;
|
||||
|
||||
@@ -1888,8 +1816,7 @@ int device_rename(struct device *dev, const char *new_name)
|
||||
if (!dev)
|
||||
return -EINVAL;
|
||||
|
||||
pr_debug("device: '%s': %s: renaming to '%s'\n", dev_name(dev),
|
||||
__func__, new_name);
|
||||
dev_dbg(dev, "renaming to %s\n", new_name);
|
||||
|
||||
old_device_name = kstrdup(dev_name(dev), GFP_KERNEL);
|
||||
if (!old_device_name) {
|
||||
@@ -1898,13 +1825,14 @@ int device_rename(struct device *dev, const char *new_name)
|
||||
}
|
||||
|
||||
if (dev->class) {
|
||||
error = sysfs_rename_link(&dev->class->p->subsys.kobj,
|
||||
&dev->kobj, old_device_name, new_name);
|
||||
error = sysfs_rename_link_ns(&dev->class->p->subsys.kobj,
|
||||
kobj, old_device_name,
|
||||
new_name, kobject_namespace(kobj));
|
||||
if (error)
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = kobject_rename(&dev->kobj, new_name);
|
||||
error = kobject_rename(kobj, new_name);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
|
||||
+18
-13
@@ -91,7 +91,8 @@ static __always_inline struct devres * alloc_dr(dr_release_t release,
|
||||
if (unlikely(!dr))
|
||||
return NULL;
|
||||
|
||||
memset(dr, 0, tot_size);
|
||||
memset(dr, 0, offsetof(struct devres, data));
|
||||
|
||||
INIT_LIST_HEAD(&dr->node.entry);
|
||||
dr->node.release = release;
|
||||
return dr;
|
||||
@@ -110,7 +111,7 @@ void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
|
||||
{
|
||||
struct devres *dr;
|
||||
|
||||
dr = alloc_dr(release, size, gfp);
|
||||
dr = alloc_dr(release, size, gfp | __GFP_ZERO);
|
||||
if (unlikely(!dr))
|
||||
return NULL;
|
||||
set_node_dbginfo(&dr->node, name, size);
|
||||
@@ -135,7 +136,7 @@ void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
|
||||
{
|
||||
struct devres *dr;
|
||||
|
||||
dr = alloc_dr(release, size, gfp);
|
||||
dr = alloc_dr(release, size, gfp | __GFP_ZERO);
|
||||
if (unlikely(!dr))
|
||||
return NULL;
|
||||
return dr->data;
|
||||
@@ -745,58 +746,62 @@ void devm_remove_action(struct device *dev, void (*action)(void *), void *data)
|
||||
EXPORT_SYMBOL_GPL(devm_remove_action);
|
||||
|
||||
/*
|
||||
* Managed kzalloc/kfree
|
||||
* Managed kmalloc/kfree
|
||||
*/
|
||||
static void devm_kzalloc_release(struct device *dev, void *res)
|
||||
static void devm_kmalloc_release(struct device *dev, void *res)
|
||||
{
|
||||
/* noop */
|
||||
}
|
||||
|
||||
static int devm_kzalloc_match(struct device *dev, void *res, void *data)
|
||||
static int devm_kmalloc_match(struct device *dev, void *res, void *data)
|
||||
{
|
||||
return res == data;
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_kzalloc - Resource-managed kzalloc
|
||||
* devm_kmalloc - Resource-managed kmalloc
|
||||
* @dev: Device to allocate memory for
|
||||
* @size: Allocation size
|
||||
* @gfp: Allocation gfp flags
|
||||
*
|
||||
* Managed kzalloc. Memory allocated with this function is
|
||||
* Managed kmalloc. Memory allocated with this function is
|
||||
* automatically freed on driver detach. Like all other devres
|
||||
* resources, guaranteed alignment is unsigned long long.
|
||||
*
|
||||
* RETURNS:
|
||||
* Pointer to allocated memory on success, NULL on failure.
|
||||
*/
|
||||
void * devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
|
||||
void * devm_kmalloc(struct device *dev, size_t size, gfp_t gfp)
|
||||
{
|
||||
struct devres *dr;
|
||||
|
||||
/* use raw alloc_dr for kmalloc caller tracing */
|
||||
dr = alloc_dr(devm_kzalloc_release, size, gfp);
|
||||
dr = alloc_dr(devm_kmalloc_release, size, gfp);
|
||||
if (unlikely(!dr))
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* This is named devm_kzalloc_release for historical reasons
|
||||
* The initial implementation did not support kmalloc, only kzalloc
|
||||
*/
|
||||
set_node_dbginfo(&dr->node, "devm_kzalloc_release", size);
|
||||
devres_add(dev, dr->data);
|
||||
return dr->data;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_kzalloc);
|
||||
EXPORT_SYMBOL_GPL(devm_kmalloc);
|
||||
|
||||
/**
|
||||
* devm_kfree - Resource-managed kfree
|
||||
* @dev: Device this memory belongs to
|
||||
* @p: Memory to free
|
||||
*
|
||||
* Free memory allocated with devm_kzalloc().
|
||||
* Free memory allocated with devm_kmalloc().
|
||||
*/
|
||||
void devm_kfree(struct device *dev, void *p)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = devres_destroy(dev, devm_kzalloc_release, devm_kzalloc_match, p);
|
||||
rc = devres_destroy(dev, devm_kmalloc_release, devm_kmalloc_match, p);
|
||||
WARN_ON(rc);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_kfree);
|
||||
|
||||
@@ -282,31 +282,35 @@ static noinline_for_stack long fw_file_size(struct file *file)
|
||||
return st.size;
|
||||
}
|
||||
|
||||
static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf)
|
||||
static int fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf)
|
||||
{
|
||||
long size;
|
||||
char *buf;
|
||||
int rc;
|
||||
|
||||
size = fw_file_size(file);
|
||||
if (size <= 0)
|
||||
return false;
|
||||
return -EINVAL;
|
||||
buf = vmalloc(size);
|
||||
if (!buf)
|
||||
return false;
|
||||
if (kernel_read(file, 0, buf, size) != size) {
|
||||
return -ENOMEM;
|
||||
rc = kernel_read(file, 0, buf, size);
|
||||
if (rc != size) {
|
||||
if (rc > 0)
|
||||
rc = -EIO;
|
||||
vfree(buf);
|
||||
return false;
|
||||
return rc;
|
||||
}
|
||||
fw_buf->data = buf;
|
||||
fw_buf->size = size;
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool fw_get_filesystem_firmware(struct device *device,
|
||||
static int fw_get_filesystem_firmware(struct device *device,
|
||||
struct firmware_buf *buf)
|
||||
{
|
||||
int i;
|
||||
bool success = false;
|
||||
int rc = -ENOENT;
|
||||
char *path = __getname();
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(fw_path); i++) {
|
||||
@@ -321,14 +325,17 @@ static bool fw_get_filesystem_firmware(struct device *device,
|
||||
file = filp_open(path, O_RDONLY, 0);
|
||||
if (IS_ERR(file))
|
||||
continue;
|
||||
success = fw_read_file_contents(file, buf);
|
||||
rc = fw_read_file_contents(file, buf);
|
||||
fput(file);
|
||||
if (success)
|
||||
if (rc)
|
||||
dev_warn(device, "firmware, attempted to load %s, but failed with error %d\n",
|
||||
path, rc);
|
||||
else
|
||||
break;
|
||||
}
|
||||
__putname(path);
|
||||
|
||||
if (success) {
|
||||
if (!rc) {
|
||||
dev_dbg(device, "firmware: direct-loading firmware %s\n",
|
||||
buf->fw_id);
|
||||
mutex_lock(&fw_lock);
|
||||
@@ -337,7 +344,7 @@ static bool fw_get_filesystem_firmware(struct device *device,
|
||||
mutex_unlock(&fw_lock);
|
||||
}
|
||||
|
||||
return success;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* firmware holds the ownership of pages */
|
||||
@@ -1086,9 +1093,14 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
|
||||
}
|
||||
}
|
||||
|
||||
if (!fw_get_filesystem_firmware(device, fw->priv))
|
||||
ret = fw_get_filesystem_firmware(device, fw->priv);
|
||||
if (ret) {
|
||||
dev_warn(device, "Direct firmware load failed with error %d\n",
|
||||
ret);
|
||||
dev_warn(device, "Falling back to user helper\n");
|
||||
ret = fw_load_from_user_helper(fw, name, device,
|
||||
uevent, nowait, timeout);
|
||||
}
|
||||
|
||||
/* don't cache firmware handled without uevent */
|
||||
if (!ret)
|
||||
|
||||
+13
-4
@@ -488,6 +488,11 @@ static int platform_drv_probe(struct device *_dev)
|
||||
if (ret && ACPI_HANDLE(_dev))
|
||||
acpi_dev_pm_detach(_dev, true);
|
||||
|
||||
if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
|
||||
dev_warn(_dev, "probe deferral not supported\n");
|
||||
ret = -ENXIO;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -553,8 +558,7 @@ EXPORT_SYMBOL_GPL(platform_driver_unregister);
|
||||
/**
|
||||
* platform_driver_probe - register driver for non-hotpluggable device
|
||||
* @drv: platform driver structure
|
||||
* @probe: the driver probe routine, probably from an __init section,
|
||||
* must not return -EPROBE_DEFER.
|
||||
* @probe: the driver probe routine, probably from an __init section
|
||||
*
|
||||
* Use this instead of platform_driver_register() when you know the device
|
||||
* is not hotpluggable and has already been registered, and you want to
|
||||
@@ -565,8 +569,7 @@ EXPORT_SYMBOL_GPL(platform_driver_unregister);
|
||||
* into system-on-chip processors, where the controller devices have been
|
||||
* configured as part of board setup.
|
||||
*
|
||||
* This is incompatible with deferred probing so probe() must not
|
||||
* return -EPROBE_DEFER.
|
||||
* Note that this is incompatible with deferred probing.
|
||||
*
|
||||
* Returns zero if the driver registered and bound to a device, else returns
|
||||
* a negative error code and with the driver not registered.
|
||||
@@ -576,6 +579,12 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,
|
||||
{
|
||||
int retval, code;
|
||||
|
||||
/*
|
||||
* Prevent driver from requesting probe deferral to avoid further
|
||||
* futile probe attempts.
|
||||
*/
|
||||
drv->prevent_deferred_probe = true;
|
||||
|
||||
/* make sure driver won't have bind/unbind attributes */
|
||||
drv->driver.suppress_bind_attrs = true;
|
||||
|
||||
|
||||
+16
-7
@@ -30,28 +30,37 @@ static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, cha
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
return sprintf(buf, "0x%03X\n", core->id.manuf);
|
||||
}
|
||||
static DEVICE_ATTR_RO(manuf);
|
||||
|
||||
static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
return sprintf(buf, "0x%03X\n", core->id.id);
|
||||
}
|
||||
static DEVICE_ATTR_RO(id);
|
||||
|
||||
static ssize_t rev_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
return sprintf(buf, "0x%02X\n", core->id.rev);
|
||||
}
|
||||
static DEVICE_ATTR_RO(rev);
|
||||
|
||||
static ssize_t class_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
return sprintf(buf, "0x%X\n", core->id.class);
|
||||
}
|
||||
static struct device_attribute bcma_device_attrs[] = {
|
||||
__ATTR_RO(manuf),
|
||||
__ATTR_RO(id),
|
||||
__ATTR_RO(rev),
|
||||
__ATTR_RO(class),
|
||||
__ATTR_NULL,
|
||||
static DEVICE_ATTR_RO(class);
|
||||
|
||||
static struct attribute *bcma_device_attrs[] = {
|
||||
&dev_attr_manuf.attr,
|
||||
&dev_attr_id.attr,
|
||||
&dev_attr_rev.attr,
|
||||
&dev_attr_class.attr,
|
||||
NULL,
|
||||
};
|
||||
ATTRIBUTE_GROUPS(bcma_device);
|
||||
|
||||
static struct bus_type bcma_bus_type = {
|
||||
.name = "bcma",
|
||||
@@ -59,7 +68,7 @@ static struct bus_type bcma_bus_type = {
|
||||
.probe = bcma_device_probe,
|
||||
.remove = bcma_device_remove,
|
||||
.uevent = bcma_device_uevent,
|
||||
.dev_attrs = bcma_device_attrs,
|
||||
.dev_groups = bcma_device_groups,
|
||||
};
|
||||
|
||||
static u16 bcma_cc_core_id(struct bcma_bus *bus)
|
||||
|
||||
@@ -408,7 +408,7 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
|
||||
IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING;
|
||||
|
||||
if (!value_sd) {
|
||||
value_sd = sysfs_get_dirent(dev->kobj.sd, NULL, "value");
|
||||
value_sd = sysfs_get_dirent(dev->kobj.sd, "value");
|
||||
if (!value_sd) {
|
||||
ret = -ENODEV;
|
||||
goto err_out;
|
||||
|
||||
+6
-4
@@ -33,11 +33,13 @@ static ssize_t modalias_show(struct device *dev,
|
||||
{
|
||||
return sprintf(buf, "hsi:%s\n", dev_name(dev));
|
||||
}
|
||||
static DEVICE_ATTR_RO(modalias);
|
||||
|
||||
static struct device_attribute hsi_bus_dev_attrs[] = {
|
||||
__ATTR_RO(modalias),
|
||||
__ATTR_NULL,
|
||||
static struct attribute *hsi_bus_dev_attrs[] = {
|
||||
&dev_attr_modalias.attr,
|
||||
NULL,
|
||||
};
|
||||
ATTRIBUTE_GROUPS(hsi_bus_dev);
|
||||
|
||||
static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
@@ -53,7 +55,7 @@ static int hsi_bus_match(struct device *dev, struct device_driver *driver)
|
||||
|
||||
static struct bus_type hsi_bus_type = {
|
||||
.name = "hsi",
|
||||
.dev_attrs = hsi_bus_dev_attrs,
|
||||
.dev_groups = hsi_bus_dev_groups,
|
||||
.match = hsi_bus_match,
|
||||
.uevent = hsi_bus_uevent,
|
||||
};
|
||||
|
||||
+26
-9
@@ -25,6 +25,7 @@ static ssize_t media_show(struct device *dev, struct device_attribute *attr,
|
||||
ide_drive_t *drive = to_ide_device(dev);
|
||||
return sprintf(buf, "%s\n", ide_media_string(drive));
|
||||
}
|
||||
static DEVICE_ATTR_RO(media);
|
||||
|
||||
static ssize_t drivename_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
@@ -32,6 +33,7 @@ static ssize_t drivename_show(struct device *dev, struct device_attribute *attr,
|
||||
ide_drive_t *drive = to_ide_device(dev);
|
||||
return sprintf(buf, "%s\n", drive->name);
|
||||
}
|
||||
static DEVICE_ATTR_RO(drivename);
|
||||
|
||||
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
@@ -39,6 +41,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
|
||||
ide_drive_t *drive = to_ide_device(dev);
|
||||
return sprintf(buf, "ide:m-%s\n", ide_media_string(drive));
|
||||
}
|
||||
static DEVICE_ATTR_RO(modalias);
|
||||
|
||||
static ssize_t model_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
@@ -46,6 +49,7 @@ static ssize_t model_show(struct device *dev, struct device_attribute *attr,
|
||||
ide_drive_t *drive = to_ide_device(dev);
|
||||
return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_PROD]);
|
||||
}
|
||||
static DEVICE_ATTR_RO(model);
|
||||
|
||||
static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
@@ -53,6 +57,7 @@ static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
|
||||
ide_drive_t *drive = to_ide_device(dev);
|
||||
return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_FW_REV]);
|
||||
}
|
||||
static DEVICE_ATTR_RO(firmware);
|
||||
|
||||
static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
@@ -60,16 +65,28 @@ static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
|
||||
ide_drive_t *drive = to_ide_device(dev);
|
||||
return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_SERNO]);
|
||||
}
|
||||
static DEVICE_ATTR(serial, 0400, serial_show, NULL);
|
||||
|
||||
struct device_attribute ide_dev_attrs[] = {
|
||||
__ATTR_RO(media),
|
||||
__ATTR_RO(drivename),
|
||||
__ATTR_RO(modalias),
|
||||
__ATTR_RO(model),
|
||||
__ATTR_RO(firmware),
|
||||
__ATTR(serial, 0400, serial_show, NULL),
|
||||
__ATTR(unload_heads, 0644, ide_park_show, ide_park_store),
|
||||
__ATTR_NULL
|
||||
static DEVICE_ATTR(unload_heads, 0644, ide_park_show, ide_park_store);
|
||||
|
||||
static struct attribute *ide_attrs[] = {
|
||||
&dev_attr_media.attr,
|
||||
&dev_attr_drivename.attr,
|
||||
&dev_attr_modalias.attr,
|
||||
&dev_attr_model.attr,
|
||||
&dev_attr_firmware.attr,
|
||||
&dev_attr_serial.attr,
|
||||
&dev_attr_unload_heads.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group ide_attr_group = {
|
||||
.attrs = ide_attrs,
|
||||
};
|
||||
|
||||
const struct attribute_group *ide_dev_groups[] = {
|
||||
&ide_attr_group,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static ssize_t store_delete_devices(struct device *portdev,
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ struct bus_type ide_bus_type = {
|
||||
.probe = generic_ide_probe,
|
||||
.remove = generic_ide_remove,
|
||||
.shutdown = generic_ide_shutdown,
|
||||
.dev_attrs = ide_dev_attrs,
|
||||
.dev_groups = ide_dev_groups,
|
||||
.suspend = generic_ide_suspend,
|
||||
.resume = generic_ide_resume,
|
||||
};
|
||||
|
||||
@@ -422,14 +422,15 @@ static struct gameport *gameport_get_pending_child(struct gameport *parent)
|
||||
* Gameport port operations
|
||||
*/
|
||||
|
||||
static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t gameport_description_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct gameport *gameport = to_gameport_port(dev);
|
||||
|
||||
return sprintf(buf, "%s\n", gameport->name);
|
||||
}
|
||||
static DEVICE_ATTR(description, S_IRUGO, gameport_description_show, NULL);
|
||||
|
||||
static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
|
||||
static ssize_t drvctl_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct gameport *gameport = to_gameport_port(dev);
|
||||
struct device_driver *drv;
|
||||
@@ -457,12 +458,14 @@ static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribut
|
||||
|
||||
return error ? error : count;
|
||||
}
|
||||
static DEVICE_ATTR_WO(drvctl);
|
||||
|
||||
static struct device_attribute gameport_device_attrs[] = {
|
||||
__ATTR(description, S_IRUGO, gameport_show_description, NULL),
|
||||
__ATTR(drvctl, S_IWUSR, NULL, gameport_rebind_driver),
|
||||
__ATTR_NULL
|
||||
static struct attribute *gameport_device_attrs[] = {
|
||||
&dev_attr_description.attr,
|
||||
&dev_attr_drvctl.attr,
|
||||
NULL,
|
||||
};
|
||||
ATTRIBUTE_GROUPS(gameport_device);
|
||||
|
||||
static void gameport_release_port(struct device *dev)
|
||||
{
|
||||
@@ -750,7 +753,7 @@ static int gameport_bus_match(struct device *dev, struct device_driver *drv)
|
||||
|
||||
static struct bus_type gameport_bus = {
|
||||
.name = "gameport",
|
||||
.dev_attrs = gameport_device_attrs,
|
||||
.dev_groups = gameport_device_groups,
|
||||
.drv_groups = gameport_driver_groups,
|
||||
.match = gameport_bus_match,
|
||||
.probe = gameport_driver_probe,
|
||||
|
||||
+34
-36
@@ -365,7 +365,7 @@ static ssize_t serio_show_description(struct device *dev, struct device_attribut
|
||||
return sprintf(buf, "%s\n", serio->name);
|
||||
}
|
||||
|
||||
static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct serio *serio = to_serio_port(dev);
|
||||
|
||||
@@ -373,54 +373,31 @@ static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *
|
||||
serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
|
||||
}
|
||||
|
||||
static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct serio *serio = to_serio_port(dev);
|
||||
return sprintf(buf, "%02x\n", serio->id.type);
|
||||
}
|
||||
|
||||
static ssize_t serio_show_id_proto(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t proto_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct serio *serio = to_serio_port(dev);
|
||||
return sprintf(buf, "%02x\n", serio->id.proto);
|
||||
}
|
||||
|
||||
static ssize_t serio_show_id_id(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct serio *serio = to_serio_port(dev);
|
||||
return sprintf(buf, "%02x\n", serio->id.id);
|
||||
}
|
||||
|
||||
static ssize_t serio_show_id_extra(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t extra_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct serio *serio = to_serio_port(dev);
|
||||
return sprintf(buf, "%02x\n", serio->id.extra);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL);
|
||||
static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL);
|
||||
static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL);
|
||||
static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL);
|
||||
|
||||
static struct attribute *serio_device_id_attrs[] = {
|
||||
&dev_attr_type.attr,
|
||||
&dev_attr_proto.attr,
|
||||
&dev_attr_id.attr,
|
||||
&dev_attr_extra.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute_group serio_id_attr_group = {
|
||||
.name = "id",
|
||||
.attrs = serio_device_id_attrs,
|
||||
};
|
||||
|
||||
static const struct attribute_group *serio_device_attr_groups[] = {
|
||||
&serio_id_attr_group,
|
||||
NULL
|
||||
};
|
||||
|
||||
static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
|
||||
static ssize_t drvctl_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct serio *serio = to_serio_port(dev);
|
||||
struct device_driver *drv;
|
||||
@@ -474,14 +451,36 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
|
||||
return retval;
|
||||
}
|
||||
|
||||
static struct device_attribute serio_device_attrs[] = {
|
||||
__ATTR(description, S_IRUGO, serio_show_description, NULL),
|
||||
__ATTR(modalias, S_IRUGO, serio_show_modalias, NULL),
|
||||
__ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
|
||||
__ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
|
||||
__ATTR_NULL
|
||||
static DEVICE_ATTR_RO(type);
|
||||
static DEVICE_ATTR_RO(proto);
|
||||
static DEVICE_ATTR_RO(id);
|
||||
static DEVICE_ATTR_RO(extra);
|
||||
static DEVICE_ATTR_RO(modalias);
|
||||
static DEVICE_ATTR_WO(drvctl);
|
||||
static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL);
|
||||
static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode);
|
||||
|
||||
static struct attribute *serio_device_id_attrs[] = {
|
||||
&dev_attr_type.attr,
|
||||
&dev_attr_proto.attr,
|
||||
&dev_attr_id.attr,
|
||||
&dev_attr_extra.attr,
|
||||
&dev_attr_modalias.attr,
|
||||
&dev_attr_description.attr,
|
||||
&dev_attr_drvctl.attr,
|
||||
&dev_attr_bind_mode.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute_group serio_id_attr_group = {
|
||||
.name = "id",
|
||||
.attrs = serio_device_id_attrs,
|
||||
};
|
||||
|
||||
static const struct attribute_group *serio_device_attr_groups[] = {
|
||||
&serio_id_attr_group,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void serio_release_port(struct device *dev)
|
||||
{
|
||||
@@ -996,7 +995,6 @@ EXPORT_SYMBOL(serio_interrupt);
|
||||
|
||||
static struct bus_type serio_bus = {
|
||||
.name = "serio",
|
||||
.dev_attrs = serio_device_attrs,
|
||||
.drv_groups = serio_driver_groups,
|
||||
.match = serio_bus_match,
|
||||
.uevent = serio_uevent,
|
||||
|
||||
+15
-7
@@ -180,20 +180,28 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
|
||||
|
||||
ipack_device_attr(id_format, "0x%hhu\n");
|
||||
|
||||
static struct device_attribute ipack_dev_attrs[] = {
|
||||
__ATTR_RO(id),
|
||||
__ATTR_RO(id_device),
|
||||
__ATTR_RO(id_format),
|
||||
__ATTR_RO(id_vendor),
|
||||
__ATTR_RO(modalias),
|
||||
static DEVICE_ATTR_RO(id);
|
||||
static DEVICE_ATTR_RO(id_device);
|
||||
static DEVICE_ATTR_RO(id_format);
|
||||
static DEVICE_ATTR_RO(id_vendor);
|
||||
static DEVICE_ATTR_RO(modalias);
|
||||
|
||||
static struct attribute *ipack_attrs[] = {
|
||||
&dev_attr_id.attr,
|
||||
&dev_attr_id_device.attr,
|
||||
&dev_attr_id_format.attr,
|
||||
&dev_attr_id_vendor.attr,
|
||||
&dev_attr_modalias.attr,
|
||||
NULL,
|
||||
};
|
||||
ATTRIBUTE_GROUPS(ipack);
|
||||
|
||||
static struct bus_type ipack_bus_type = {
|
||||
.name = "ipack",
|
||||
.probe = ipack_bus_probe,
|
||||
.match = ipack_bus_match,
|
||||
.remove = ipack_bus_remove,
|
||||
.dev_attrs = ipack_dev_attrs,
|
||||
.dev_groups = ipack_groups,
|
||||
.uevent = ipack_uevent,
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -1654,9 +1654,9 @@ int bitmap_create(struct mddev *mddev)
|
||||
bitmap->mddev = mddev;
|
||||
|
||||
if (mddev->kobj.sd)
|
||||
bm = sysfs_get_dirent(mddev->kobj.sd, NULL, "bitmap");
|
||||
bm = sysfs_get_dirent(mddev->kobj.sd, "bitmap");
|
||||
if (bm) {
|
||||
bitmap->sysfs_can_clear = sysfs_get_dirent(bm, NULL, "can_clear");
|
||||
bitmap->sysfs_can_clear = sysfs_get_dirent(bm, "can_clear");
|
||||
sysfs_put(bm);
|
||||
} else
|
||||
bitmap->sysfs_can_clear = NULL;
|
||||
|
||||
+1
-1
@@ -3555,7 +3555,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
|
||||
printk(KERN_WARNING
|
||||
"md: cannot register extra attributes for %s\n",
|
||||
mdname(mddev));
|
||||
mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, NULL, "sync_action");
|
||||
mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action");
|
||||
}
|
||||
if (mddev->pers->sync_request != NULL &&
|
||||
pers->sync_request == NULL) {
|
||||
|
||||
+1
-1
@@ -501,7 +501,7 @@ extern struct attribute_group md_bitmap_group;
|
||||
static inline struct sysfs_dirent *sysfs_get_dirent_safe(struct sysfs_dirent *sd, char *name)
|
||||
{
|
||||
if (sd)
|
||||
return sysfs_get_dirent(sd, NULL, name);
|
||||
return sysfs_get_dirent(sd, name);
|
||||
return sd;
|
||||
}
|
||||
static inline void sysfs_notify_dirent_safe(struct sysfs_dirent *sd)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user