Re: [PATCH v3 05/11] iio: buffer: group attr count and attr alloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > >
> > > +     attr = kcalloc(buffer_attrcount + ARRAY_SIZE(iio_buffer_attrs) + 1,
> > > +                    sizeof(struct attribute *), GFP_KERNEL);
> > > +     if (!attr) {
> > > +             ret = -ENOMEM;
> > > +             goto error_free_scan_mask;
> > > +     }
> > > +
> > > +     memcpy(attr, iio_buffer_attrs, sizeof(iio_buffer_attrs));
> > > +     if (!buffer->access->set_length)
> > > +             attr[0] = &dev_attr_length_ro.attr;
> > > +
> > > +     if (buffer->access->flags & INDIO_BUFFER_FLAG_FIXED_WATERMARK)
> > > +             attr[2] = &dev_attr_watermark_ro.attr;  
> >
> > Again a comment for the future  rather than now, but when we are copying
> > 4 items and then looking at whether to change 2 of them it might be cleaner
> > to just set them directly!  Touch of bit rot here :)  
> 
> So, I've been on-and-off about how to deal with this one.
> I wanted to clean it in various ways using new kernel sysfs APIs.
> Maybe, also remove the readonly variants and use the is_visible()
> property to set RO/RW modes.
> But I also came to the conclusion that this is an idea to address later.
> Trying to address this early-on confused me with other overlapping changes.
Absolutely agree. It's not something to do in this series.

Jonathan



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux