lkml.org 
[lkml]   [2012]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 8/8] staging: comedi: cleanup comedi_alloc_subdevices
On Tue, Jun 12, 2012 at 03:20:32PM -0500, H Hartley Sweeten wrote:
> On Tuesday, June 12, 2012 12:50 PM, Dan Carpenter wrote:
> > On Tue, Jun 12, 2012 at 11:59:55AM -0700, H Hartley Sweeten wrote:
> >> for (i = 0; i < num_subdevices; ++i) {
> >> - dev->subdevices[i].device = dev;
> >> - dev->subdevices[i].async_dma_dir = DMA_NONE;
> >> - spin_lock_init(&dev->subdevices[i].spin_lock);
> >> - dev->subdevices[i].minor = -1;
> >> + s = dev->subdevices + i;
> >
> > You don't have to resend, but I think this would look better as:
> >
> > s = &dev->subdevices[i];
>
> I don't disagree but the "dev->subdevices +i" format is consistently
> used in all the comedi stuff. If the format above is preferred we
> should probably update everything,

To me the one is way more clear than the other. If we wanted we
could write any array in terms of pointer math, but arrays are
easier to understand.

regards,
dan carpenter



\
 
 \ /
  Last update: 2012-06-13 09:01    [W:0.040 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site