Can I use DEVICE_INT_ATTR() so that probing and removing sysfs enteries happens automatically?

From: Jamie Risk
Date: Tue Jul 08 2014 - 01:17:09 EST


What is the proper way to use the 'DEVICE_(INT|ULONG|BOOL)_ATTR()'
macros with a platform driver? Or, am I best using per attribute pairs
of show/store functions?

If I code my own 'show()' and 'store()' functions and use the
'DEVICE_ATTR()' macros things work happily with an assignment of
'struct attribute_group * attr_groups[];' to the 'struct
device_driver' 'groups' field. i.e.

static struct platform_driver platform = { /* ... */ .driver = {
.groups = attr_groups, /* ... */ }, };

If I use the 'DEVICE_INT_ATTR()' macro (for
'device_(show|store)_int()' utility) the attribute appears in sysfs,
but accesses cause an OOPs: 'device_show_int()' is called via
'drv_attr_show()' with an inappropriate signature.

Whats a correct/corrected approach?

- Jamie
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/