aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-06 20:03:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-06 21:42:15 -0500
commit0324e74534241f3f00910ec04ef67de1fe1542f4 (patch)
tree88f0b2a40a47dc0a22c0ce5e9b75a58470a56204 /drivers/input/serio
parent1071ec7bc2dabd0a9d12a1ae5570f4fd3ba944ca (diff)
parent0cae60f91494e34a0c5391f1455f825d5849b05f (diff)
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 ...
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/serio.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 2b56855c2c77..98707fb2cb5d 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -365,7 +365,7 @@ static ssize_t serio_show_description(struct device *dev, struct device_attribut
365 return sprintf(buf, "%s\n", serio->name); 365 return sprintf(buf, "%s\n", serio->name);
366} 366}
367 367
368static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 368static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
369{ 369{
370 struct serio *serio = to_serio_port(dev); 370 struct serio *serio = to_serio_port(dev);
371 371
@@ -373,54 +373,31 @@ static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *
373 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); 373 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
374} 374}
375 375
376static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) 376static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf)
377{ 377{
378 struct serio *serio = to_serio_port(dev); 378 struct serio *serio = to_serio_port(dev);
379 return sprintf(buf, "%02x\n", serio->id.type); 379 return sprintf(buf, "%02x\n", serio->id.type);
380} 380}
381 381
382static ssize_t serio_show_id_proto(struct device *dev, struct device_attribute *attr, char *buf) 382static ssize_t proto_show(struct device *dev, struct device_attribute *attr, char *buf)
383{ 383{
384 struct serio *serio = to_serio_port(dev); 384 struct serio *serio = to_serio_port(dev);
385 return sprintf(buf, "%02x\n", serio->id.proto); 385 return sprintf(buf, "%02x\n", serio->id.proto);
386} 386}
387 387
388static ssize_t serio_show_id_id(struct device *dev, struct device_attribute *attr, char *buf) 388static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
389{ 389{
390 struct serio *serio = to_serio_port(dev); 390 struct serio *serio = to_serio_port(dev);
391 return sprintf(buf, "%02x\n", serio->id.id); 391 return sprintf(buf, "%02x\n", serio->id.id);
392} 392}
393 393
394static ssize_t serio_show_id_extra(struct device *dev, struct device_attribute *attr, char *buf) 394static ssize_t extra_show(struct device *dev, struct device_attribute *attr, char *buf)
395{ 395{
396 struct serio *serio = to_serio_port(dev); 396 struct serio *serio = to_serio_port(dev);
397 return sprintf(buf, "%02x\n", serio->id.extra); 397 return sprintf(buf, "%02x\n", serio->id.extra);
398} 398}
399 399
400static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL); 400static ssize_t drvctl_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
401static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL);
402static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL);
403static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL);
404
405static struct attribute *serio_device_id_attrs[] = {
406 &dev_attr_type.attr,
407 &dev_attr_proto.attr,
408 &dev_attr_id.attr,
409 &dev_attr_extra.attr,
410 NULL
411};
412
413static struct attribute_group serio_id_attr_group = {
414 .name = "id",
415 .attrs = serio_device_id_attrs,
416};
417
418static const struct attribute_group *serio_device_attr_groups[] = {
419 &serio_id_attr_group,
420 NULL
421};
422
423static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
424{ 401{
425 struct serio *serio = to_serio_port(dev); 402 struct serio *serio = to_serio_port(dev);
426 struct device_driver *drv; 403 struct device_driver *drv;
@@ -474,14 +451,36 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
474 return retval; 451 return retval;
475} 452}
476 453
477static struct device_attribute serio_device_attrs[] = { 454static DEVICE_ATTR_RO(type);
478 __ATTR(description, S_IRUGO, serio_show_description, NULL), 455static DEVICE_ATTR_RO(proto);
479 __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL), 456static DEVICE_ATTR_RO(id);
480 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), 457static DEVICE_ATTR_RO(extra);
481 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), 458static DEVICE_ATTR_RO(modalias);
482 __ATTR_NULL 459static DEVICE_ATTR_WO(drvctl);
460static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL);
461static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode);
462
463static struct attribute *serio_device_id_attrs[] = {
464 &dev_attr_type.attr,
465 &dev_attr_proto.attr,
466 &dev_attr_id.attr,
467 &dev_attr_extra.attr,
468 &dev_attr_modalias.attr,
469 &dev_attr_description.attr,
470 &dev_attr_drvctl.attr,
471 &dev_attr_bind_mode.attr,
472 NULL
483}; 473};
484 474
475static struct attribute_group serio_id_attr_group = {
476 .name = "id",
477 .attrs = serio_device_id_attrs,
478};
479
480static const struct attribute_group *serio_device_attr_groups[] = {
481 &serio_id_attr_group,
482 NULL
483};
485 484
486static void serio_release_port(struct device *dev) 485static void serio_release_port(struct device *dev)
487{ 486{
@@ -996,7 +995,6 @@ EXPORT_SYMBOL(serio_interrupt);
996 995
997static struct bus_type serio_bus = { 996static struct bus_type serio_bus = {
998 .name = "serio", 997 .name = "serio",
999 .dev_attrs = serio_device_attrs,
1000 .drv_groups = serio_driver_groups, 998 .drv_groups = serio_driver_groups,
1001 .match = serio_bus_match, 999 .match = serio_bus_match,
1002 .uevent = serio_uevent, 1000 .uevent = serio_uevent,