public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* Does anybody know conn->power_save variable in hci_conn.c?
@ 2009-07-07  8:28 Chan-Yeol Park
  2009-07-07 17:36 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Chan-Yeol Park @ 2009-07-07  8:28 UTC (permalink / raw)
  To: linux-bluetooth

Dear bluez developer!

/*bluetooth kernel hci_conn.c */
382 void hci_conn_enter_active_mode(struct hci_conn *conn)
383 {
384         struct hci_dev *hdev = conn->hdev;
385
386         BT_DBG("conn %p mode %d", conn, conn->mode);
387
388         if (test_bit(HCI_RAW, &hdev->flags))
389                 return;
390
391         if (conn->mode != HCI_CM_SNIFF || !conn->power_save)
392                 goto timer;
393 
394         if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
395                 struct hci_cp_exit_sniff_mode cp;
396                 cp.handle = __cpu_to_le16(conn->handle);
397                 hci_send_cmd(hdev, OGF_LINK_POLICY,
398                                 OCF_EXIT_SNIFF_MODE, sizeof(cp), &cp);
399         }
400
401 timer:
402         if (hdev->idle_timeout > 0)
403                 mod_timer(&conn->idle_timer,
404                         jiffies + msecs_to_jiffies(hdev->idle_timeout));
405 }
406 

If possible, could you explain why this code checks !conn->power_save var.? 

Without this , if  conn->mode==HCI_CM_SNIFF , we simply exit sniff
mode,"OCF_EXIT_SNIFF_MODE".

As far as I understood, whenever conn->mode is HCI_CM_SNIFF conn->power_save
is 0.
The reason is that  hci_mode_change_evt() set conn->power_save as "0" when
conn->mode !=HCI_CM_ACTIVE.

Consequently we don't need to check that variable.

Regards 
Chanyeol.





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

end of thread, other threads:[~2009-07-08  5:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-07  8:28 Does anybody know conn->power_save variable in hci_conn.c? Chan-Yeol Park
2009-07-07 17:36 ` Marcel Holtmann
2009-07-08  1:36   ` Chan-Yeol Park
2009-07-08  3:38     ` Marcel Holtmann
2009-07-08  4:47       ` Chan-Yeol Park
2009-07-08  5:09         ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox