linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: Ulisses Furquim <ulisses@profusion.mobi>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFC 2/2] Bluetooth: Process HCI callbacks in a workqueue
Date: Wed, 7 Mar 2012 11:22:15 +0200	[thread overview]
Message-ID: <20120307092214.GD3647@aemeltch-MOBL1> (raw)
In-Reply-To: <CAA37ikYKJqpOj0JQ9x2DUQ2pYGos66WD4oodFchTDKA2UKFY0A@mail.gmail.com>

Hi Ulisses,

On Tue, Mar 06, 2012 at 12:02:11PM -0300, Ulisses Furquim wrote:
> >
> > +struct cb_work {
> 
> Again, maybe hci_cb_work?

OK.

> > +       struct work_struct work;
> > +       struct hci_dev *hdev;
> > +       struct cb_cmd *cmd;
> > +};
> > +
> > +static void hci_cb_work(struct work_struct *w)
> 
> And here hci_cb_worker?

Sounds good.

> > +{
> > +       struct cb_work *work = (struct cb_work *) w;
> > +       struct cb_cmd *cmd = work->cmd;
> > +       struct hci_dev *hdev = work->hdev;
> > +
> > +       cmd->cb(hdev, cmd);
> > +
> > +       hci_dev_put(hdev);
> > +
> > +       hci_remove_cb(cmd);
> > +       kfree(w);
> > +}
> > +
> > +void hci_queue_cb(struct hci_dev *hdev, struct cb_cmd *cmd,
> > +                                       struct workqueue_struct *workqueue)
> > +{
> > +       struct cb_work *work;
> > +
> > +       BT_ERR("Queue cmd %p opt %p", cmd, cmd->opt);
> > +
> > +       work = kmalloc(sizeof(*work), GFP_ATOMIC);
> 
> Why not GFP_KERNEL?

Sure.

> 
> > +       if (!work)
> > +               return;
> > +
> > +       INIT_WORK(&work->work, hci_cb_work);
> > +       work->hdev = hdev;
> > +       work->cmd = cmd;
> > +       hci_dev_hold(hdev);
> > +
> > +       if (!queue_work(workqueue, &work->work)) {
> > +               kfree(work);
> > +               hci_dev_put(hdev);
> > +       }
> > +}
> > +
> >  void hci_remove_cb(struct cb_cmd *cmd)
> >  {
> >        list_del(&cmd->list);
> 
> And again, no callers of hci_queue_cb so I'm assuming you'll only use
> in for AMP, is that it?

Yes, so far.

Thanks for the review.

Best regards 
Andrei Emeltchenko 


  reply	other threads:[~2012-03-07  9:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06 13:16 [RFC 1/2] Bluetooth: General HCI callback implementation Andrei Emeltchenko
2012-03-06 13:16 ` [RFC 2/2] Bluetooth: Process HCI callbacks in a workqueue Andrei Emeltchenko
2012-03-06 15:02   ` Ulisses Furquim
2012-03-07  9:22     ` Andrei Emeltchenko [this message]
2012-03-06 15:04   ` Szymon Janc
2012-03-07  9:23     ` Andrei Emeltchenko
2012-03-06 14:57 ` [RFC 1/2] Bluetooth: General HCI callback implementation Ulisses Furquim
2012-03-06 14:59   ` Ulisses Furquim
2012-03-07  9:13   ` Andrei Emeltchenko
2012-03-06 15:02 ` Szymon Janc
2012-03-07  9:19   ` Andrei Emeltchenko
2012-03-07 15:50   ` Andrei Emeltchenko
2012-03-08  5:53 ` Gustavo Padovan
2012-03-08  7:58   ` Andrei Emeltchenko

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=20120307092214.GD3647@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ulisses@profusion.mobi \
    /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).