All of lore.kernel.org
 help / color / mirror / Atom feed
* How to get the hci_dev from an adv instance's work struct in a linked list?
@ 2015-04-02  2:13 Florian Grandel
  2015-04-02  2:49 ` Arman Uguray
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Grandel @ 2015-04-02  2:13 UTC (permalink / raw)
  To: BlueZ development

Hi!

I got quite far today refactoring from

struct hci_dev { ... struct adv_info adv_instance; ... };

to

struct hci_dev { ... struct list_head adv_instances; ... };

But in the end I got stuck on refactoring the adv timeout callback. 
Originally it looked like this:

static void adv_timeout_expired(struct work_struct *work)
{
   struct hci_dev *hdev = container_of(work, struct hci_dev,
                                       adv_instance.timeout_exp.work);
   ...
}

But now I would have to construct a pointer to the hci_dev struct from a 
list entry:

static void adv_timeout_expired(struct work_struct *work)
{
   struct adv_info *adv_instance = container_of(work, struct adv_info,
                                                timeout_exp.work);
   ...
}

I couldn't find a way to get the list head of the adv info list entry so 
that I could retrieve its containing hci_dev structure, though.

How would I construct the required hci_dev struct from the work pointer 
in this case? Any ideas?

Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-02  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-02  2:13 How to get the hci_dev from an adv instance's work struct in a linked list? Florian Grandel
2015-04-02  2:49 ` Arman Uguray
2015-04-02  9:58   ` Florian Grandel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.