Re: [RFC 2/2] Bluetooth: Process HCI callbacks in a workqueue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 

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


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux