linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: dbrownell@users.sourceforge.net, greg@kroah.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@ozlabs.org, leoli@freescale.com,
	timur@freescale.com
Subject: Re: [PATCH 3/3] USB: driver for Freescale QUICC Engine USB Host Controller
Date: Fri, 19 Sep 2008 16:23:24 -0700	[thread overview]
Message-ID: <20080919162324.e354ed2f.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080918151746.GC31187@oksana.dev.rtsoft.ru>

On Thu, 18 Sep 2008 19:17:46 +0400
Anton Vorontsov <avorontsov@ru.mvista.com> wrote:

> This patch adds support for the FHCI USB controller, as found
> in the Freescale MPC836x and MPC832x processors. It can support
> Full or Low speed modes.
> 
> Quite a lot the hardware is doing by itself (SOF generation, CRC
> generation and checking), though scheduling and retransmission is on
> software's shoulders.
> 
> This controller does not integrate the root hub, so this driver also
> fakes one-port hub. External hub is required to support more than
> one device.
>
> ...
>

Please, no.

> new file mode 100644
> index 0000000..23716fa
> --- /dev/null
> +++ b/drivers/usb/host/fhci-cq.c
> @@ -0,0 +1,105 @@
> +/*
> + * Freescale QUICC Engine USB Host Controller Driver
> + *
> + * Copyright (c) Freescale Semicondutor, Inc. 2006.
> + *               Shlomi Gridish <gridish@freescale.com>
> + *               Jerry Huang <Chang-Ming.Huang@freescale.com>
> + * Copyright (c) Logic Product Development, Inc. 2007
> + *               Peter Barada <peterb@logicpd.com>
> + * Copyright (c) MontaVista Software, Inc. 2008.
> + *               Anton Vorontsov <avorontsov@ru.mvista.com>
> + *
> + * This program is free software; you can redistribute  it and/or modify it
> + * under  the terms of  the GNU General  Public License as published by the
> + * Free Software Foundation;  either version 2 of the  License, or (at your
> + * option) any later version.
> + */
> +
> +/* circular queue structure */

Yet another private ringbuffer implementation.  Sigh.

> +struct cir_q {
> +       int max;		/* size of queue */
> +       int max_in;	/* max items in queue */
> +       int first;	/* index of first in queue */
> +       int last;	/* index after last in queue */
> +       int read;	/* current reading position */
> +       void *table[1];	/* fake size */
> +};
> +
> +/* circular queue handle */
> +static int cq_howmany(struct cir_q *cq)
> +{
> +	int l = cq->last;
> +	int f = cq->first;
> +
> +	return l >= f ? l - f : l + cq->max - f;
> +}
> +
> +static struct cir_q *cq_new(int size)
> +{
> +	struct cir_q *cq;
> +
> +	cq = kzalloc((sizeof(*cq) + size * sizeof(void *)), GFP_KERNEL);
> +	if (cq) {
> +		cq->max = size;
> +		cq->first = 0;
> +		cq->last = 0;
> +		cq->read = 0;
> +		cq->max_in = 0;

The above four statements are unneeded.

> +	}
> +
> +	return cq;
> +}
>
> ...
>
> +++ b/drivers/usb/host/fhci-hcd.c
> @@ -0,0 +1,798 @@
> +/*
> + * Freescale QUICC Engine USB Host Controller Driver
> + *
> + * Copyright (c) Freescale Semicondutor, Inc. 2006.
> + *               Shlomi Gridish <gridish@freescale.com>
> + *               Jerry Huang <Chang-Ming.Huang@freescale.com>
> + * Copyright (c) Logic Product Development, Inc. 2007
> + *               Peter Barada <peterb@logicpd.com>
> + * Copyright (c) MontaVista Software, Inc. 2008.
> + *               Anton Vorontsov <avorontsov@ru.mvista.com>
> + *
> + * This program is free software; you can redistribute  it and/or modify it
> + * under  the terms of  the GNU General  Public License as published by the
> + * Free Software Foundation;  either version 2 of the  License, or (at your
> + * option) any later version.
> + */
> +
> +#if defined(CONFIG_FHCI_DEBUG) && !defined(DEBUG)
> +#define DEBUG
> +#endif
> +
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <linux/delay.h>
> +#include <linux/errno.h>
> +#include <linux/list.h>
> +#include <linux/interrupt.h>
> +#include <linux/io.h>
> +#include <linux/usb.h>
> +#include <linux/of_platform.h>
> +#include <linux/of_gpio.h>
> +#include <asm/qe.h>
> +#include <asm/fsl_gtm.h>
> +#include "../core/hcd.h"
> +#include "fhci.h"
> +#include "fhci-hub.c"
> +#include "fhci-q.c"
> +#include "fhci-dbg.c"
> +#include "fhci-mem.c"
> +#include "fhci-cq.c"
> +#include "fhci-tds.c"
> +#include "fhci-sched.c"

hack, gack, nack.

We know that USB likes to prevertedly #include C files all over the
place, but this doesn't mean that it's a sane, tasteful or desirable
thing to do.

I stopped looking there.  Guys - get a grip :(

  reply	other threads:[~2008-09-19 23:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 15:16 [PATCH 0/3] Patches to support QE USB Host Controller Anton Vorontsov
2008-09-18 15:17 ` [PATCH 1/3] gpiolib: make gpio_to_chip() public Anton Vorontsov
2008-09-18 15:17 ` [PATCH 2/3] powerpc/qe: new call to revert a gpio to a dedicated function Anton Vorontsov
2008-09-18 15:17 ` [PATCH 3/3] USB: driver for Freescale QUICC Engine USB Host Controller Anton Vorontsov
2008-09-19 23:23   ` Andrew Morton [this message]
2008-09-23 18:31     ` Anton Vorontsov
2008-09-23 18:32       ` [PATCH 1/2] USB: Protect hcd.h from multiple inclusions Anton Vorontsov
2008-09-23 18:32       ` [PATCH 2/2] USB: driver for Freescale QUICC Engine USB Host Controller Anton Vorontsov
2008-09-23 21:32       ` [PATCH 3/3] " Sergei Shtylyov
2008-09-23 21:35         ` Sergei Shtylyov
2008-09-23 22:57           ` Anton Vorontsov
2008-09-24 10:24             ` Sergei Shtylyov
2008-09-24 10:48               ` Sergei Shtylyov
2008-09-24 18:59               ` David Brownell
2008-09-24 19:17                 ` Sergei Shtylyov
  -- strict thread matches above, loose matches on Subject: below --
2008-08-08 16:17 [PATCH 0/3] Patches to support QE " Anton Vorontsov
2008-08-08 16:18 ` [PATCH 3/3] USB: driver for Freescale QUICC Engine " Anton Vorontsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080919162324.e354ed2f.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=avorontsov@ru.mvista.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=greg@kroah.com \
    --cc=leoli@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=timur@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).