Re: [V2 PATCH 04/10] added media agnostic (MA) USB packet handling

From: Oliver Neukum
Date: Wed Nov 12 2014 - 09:01:56 EST


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@xxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/