mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Max Krasnyansky <maxk@qualcomm.com>
To: Greg KH <greg@kroah.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-usb-devel@lists.sourceforge.net
Subject: Re: [Bluetooth] HCI USB driver update. Support for SCO over HCI USB.
Date: Tue, 29 Apr 2003 13:29:41 -0700	[thread overview]
Message-ID: <5.1.0.14.2.20030429131303.10d7f330@unixmail.qualcomm.com> (raw)
In-Reply-To: <20030429041535.GA2093@kroah.com>

At 09:15 PM 4/28/2003, Greg KH wrote:
>On Mon, Mar 24, 2003 at 09:03:28PM +0000, Linux Kernel Mailing List wrote:
>> ChangeSet 1.971.22.2, 2003/03/24 13:03:28-08:00, maxk@qualcomm.com
>> 
>>       [Bluetooth] HCI USB driver update. Support for SCO over HCI USB.
>>       URB and buffer managment rewrite.
>
>Max, you need to be very careful with this:
I know ;-)

>> +struct _urb *_urb_alloc(int isoc, int gfp)
>> +{
>> +     struct _urb *_urb = kmalloc(sizeof(struct _urb) +
>> +                             sizeof(struct usb_iso_packet_descriptor) * isoc, gfp);
>> +     if (_urb) {
>> +             memset(_urb, 0, sizeof(*_urb));
>> +             _urb->urb.count = (atomic_t)ATOMIC_INIT(1);
>> +             spin_lock_init(&_urb->urb.lock);
>> +     }
>> +     return _urb;
>> +}
>
>You aren't calling usb_alloc_urb() and:
>
>> +struct _urb *_urb_dequeue(struct _urb_queue *q)
>> +{
>> +     struct _urb *_urb = NULL;
>> +        unsigned long flags;
>> +        spin_lock_irqsave(&q->lock, flags);
>> +     {
>> +             struct list_head *head = &q->head;
>> +             struct list_head *next = head->next;
>> +             if (next != head) {
>> +                     _urb = list_entry(next, struct _urb, list);
>> +                     list_del(next); _urb->queue = NULL;
>> +             }
>> +     }
>> +     spin_unlock_irqrestore(&q->lock, flags);
>> +     return _urb;
>> +}
>
>You aren't calling usb_free_urb() as you are embedding a struct urb
>within your struct _urb structure.  Any reason you can't use a struct
>urb * instead and call the usb core's functions to create and return 
>a urb ?
I didn't want to do two allocations (one for struct _urb and one for struct urb).

>Otherwise any changes to the internal urb structures, and the
>usb_alloc_urb() and usb_free_urb() functions will have to be mirrored
>here in your functions, and I know I will forget to do that :)
How about 

static inline urb_init(urb)
{
        urb->xx = YY;
        ...
}

urb_alloc() 
{
        urb = kmalloc()
        urb_init(urb);
}

?

>Other than that, it's nice to see Bluetooth SCO support for Linux, very
>nice job.
Thank you.

I was actually going to ask you guys if you'd be interested in generalizing this _urb_queue() 
stuff that I have for other drivers. Current URB api does not provide any interface for 
queueing/linking/etc of URBs in the _driver_ itself. Things like next, prev, etc are used in 
the HCD. So if driver submits bunch of different URBs (and potentially multiple URBs of the 
same type like hci_usb does) it has to implement its own lists, arrays and stuff. I used to 
use SKBs for URB queues but struct sk_buff is to big for that simple task.

Max


  reply	other threads:[~2003-04-29 20:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200304290317.h3T3HOdA027579@hera.kernel.org>
2003-04-29  4:15 ` Greg KH
2003-04-29 20:29   ` Max Krasnyansky [this message]
2003-04-29 21:15     ` Greg KH
2003-04-29 21:34       ` Oliver Neukum
2003-04-29 21:40         ` Greg KH
2003-04-29 22:24           ` [linux-usb-devel] " Oliver Neukum
2003-04-30  0:44           ` Max Krasnyansky
2003-04-30  7:06             ` Oliver Neukum
2003-04-29 21:55       ` Max Krasnyansky
2003-04-29 22:04         ` Greg KH
2003-04-29 21:39     ` [linux-usb-devel] " David Brownell
2003-04-29 21:37       ` Greg KH
2003-04-29 22:04       ` Max Krasnyansky
2003-04-30  4:55         ` David Brownell
2003-05-08 22:55           ` Max Krasnyansky
2003-05-09 19:06             ` David Brownell
2003-05-09 19:29               ` Greg KH
2003-05-09 22:35                 ` Max Krasnyansky
2003-05-09 22:35               ` Max Krasnyansky
2003-05-09 23:05                 ` Greg KH
2003-05-10  0:48                   ` David Brownell
2003-05-10  5:06                     ` Brad Hards
2003-05-10  5:40                     ` Greg KH
2003-05-10  5:55                       ` William Lee Irwin III
2003-05-10  6:11                         ` Greg KH
2003-05-10  6:14                           ` William Lee Irwin III
2003-05-12 17:53                     ` Max Krasnyansky
2003-05-12 18:01                       ` Greg KH
2003-05-12 18:55                         ` Max Krasnyansky
2003-05-12 20:23                         ` David Brownell

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=5.1.0.14.2.20030429131303.10d7f330@unixmail.qualcomm.com \
    --to=maxk@qualcomm.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®