Re: [PATCH v8 2/2] media: video-i2c: add video-i2c driver

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

 



On 04/18/18 12:30, Sakari Ailus wrote:
> On Wed, Apr 18, 2018 at 01:46:08AM -0700, Matt Ranostay wrote:
> 
> ...
> 
>> On Wed, Apr 18, 2018 at 1:03 AM, Sakari Ailus <sakari.ailus@xxxxxx> wrote:
>>>> +             if (vid_cap_buf) {
>>>> +                     struct vb2_buffer *vb2_buf = &vid_cap_buf->vb.vb2_buf;
>>>> +                     void *vbuf = vb2_plane_vaddr(vb2_buf, 0);
>>>> +                     int ret = data->chip->xfer(data, vbuf);
>>>
>>> As the assignment in variable declaration does more than just initialise a
>>> variable, it'd be nice to make the assignment separately from the variable
>>> declaration.
>>
>> Guessing you mean it is that initialization here is getting pushed and
>> popped off the stack if the data isn't in a register?
> 
> No, just that functionality is placed where variables are declared. The
> code is easier to read if you separate the two. I.e.
> 
> int ret;
> 
> ret = ...->xfer();

Matt, I'm making a pull request for this v8. I've split up this line myself,
so no need to post a v9.

Regards,

	Hans

> 
>>
>>>
>>>> +
>>>> +                     vb2_buf->timestamp = ktime_get_ns();
>>>> +                     vid_cap_buf->vb.sequence = data->sequence++;
>>>> +                     vb2_buffer_done(vb2_buf, ret ?
>>>> +                             VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
>>>> +             }
>>>> +
>>>> +             schedule_delay = delay - (jiffies - start_jiffies);
>>>> +
>>>> +             if (time_after(jiffies, start_jiffies + delay))
>>>> +                     schedule_delay = delay;
>>>> +
>>>> +             schedule_timeout_interruptible(schedule_delay);
>>>> +     } while (!kthread_should_stop());
>>>> +
>>>> +     return 0;
>>>> +}
> 




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux