Messages in this thread |  | | Subject | Re: [V2 PATCH 04/10] added media agnostic (MA) USB packet handling | From | Oliver Neukum <> | Date | Wed, 12 Nov 2014 15:01:51 +0100 |
| |
On Mon, 2014-11-10 at 18:09 -0800, Stephanie Wallick wrote: > +/** > + * Compares 2 request IDs. Returns true if a is less than b. Handles > request id > + * wraparound. > + */ > +bool mausb_req_id_lt(u8 a, u8 b)
Unify such functions. It's just silly to have so many of them.
> +/** > + * Calculates the total length of data contained in an ms_pkt (in > bytes). > + * Returns the length of the kvec, or 0 on an error. > + */ > +static int mausb_ms_data_length(struct ms_pkt *pkt) > +{ > + int i; > + int total_length; > + struct kvec *current_kvec; > + > + for (i = 0; i < pkt->nents; ++i) { > + current_kvec = &pkt->kvec[i]; > + if (NULL == current_kvec) > + return -EINVAL; > + else > + total_length += current_kvec->iov_len; > + } > + > + return total_length; > +} > +
Regards Oliver
-- Oliver Neukum <oneukum@suse.de>
|  |