Commit df0a67b1 authored by Federico Vaga's avatar Federico Vaga

sysfs: add parent zobj_head to attributes

It will be necessary on "write control" patch

This allows to easily retrieve the ZIO object that owns a
given zio_attribute
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
Acked-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 0beab6a2
......@@ -23,7 +23,8 @@
*
* A zio_attribute provides a generic way to access those registers
*
* @attribute: standard attribute structure used to create a sysfs access
* @parent: ponter to the zio object where this attribute is declared
* @attr: standard attribute structure used to create a sysfs access
* @flags: to set attribute capabilities
* @index [INTERNAL]: index within a group of attribute (standard or extended)
* @id: something unique to identify the attribute. It can be the register
......@@ -34,6 +35,7 @@
* @store: is equivalent to conf_set from zio_operations
*/
struct zio_attribute {
struct zio_obj_head *parent;
struct device_attribute attr;
uint32_t flags;
int index;
......
......@@ -1085,6 +1085,7 @@ static int zattr_set_create(struct zio_obj_head *head,
zattr->s_op = s_op;
}
zattr->index = i;
zattr->parent = head;
break;
case -EINVAL: /* unused std attribute */
zattr->index = ZIO_ATTR_INDEX_NONE;
......@@ -1111,11 +1112,11 @@ ext:
head->name, i, attr->name);
/* valid attribute */
groups[g]->attrs[a_count++] = attr;
zattr->attr.show = zattr_show;
zattr->attr.store = zattr_store;
zattr->s_op = s_op;
zattr->index = i;
zattr->parent = head;
zattr->flags |= ZIO_ATTR_TYPE_EXT;
}
++g;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment