Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Rename driver .prevent_wake to .wakeup

prevent_wake logic is backward since what it is really checking is
if the device may wakeup the system or not, not that it will prevent
the to be awaken.

Also looking on how other subsystems have the entry as power/wakeup
this also renames the force_prevent_wake to force_wakeup in vhci driver.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

+32 -31
+3 -3
drivers/bluetooth/btmrvl_main.c
··· 587 587 return 0; 588 588 } 589 589 590 - static bool btmrvl_prevent_wake(struct hci_dev *hdev) 590 + static bool btmrvl_wakeup(struct hci_dev *hdev) 591 591 { 592 592 struct btmrvl_private *priv = hci_get_drvdata(hdev); 593 593 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; 594 594 595 - return !device_may_wakeup(&card->func->dev); 595 + return device_may_wakeup(&card->func->dev); 596 596 } 597 597 598 598 /* ··· 696 696 hdev->send = btmrvl_send_frame; 697 697 hdev->setup = btmrvl_setup; 698 698 hdev->set_bdaddr = btmrvl_set_bdaddr; 699 - hdev->prevent_wake = btmrvl_prevent_wake; 699 + hdev->wakeup = btmrvl_wakeup; 700 700 SET_HCIDEV_DEV(hdev, &card->func->dev); 701 701 702 702 hdev->dev_type = priv->btmrvl_dev.dev_type;
+3 -3
drivers/bluetooth/btusb.c
··· 3640 3640 interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME; 3641 3641 } 3642 3642 3643 - static bool btusb_prevent_wake(struct hci_dev *hdev) 3643 + static bool btusb_wakeup(struct hci_dev *hdev) 3644 3644 { 3645 3645 struct btusb_data *data = hci_get_drvdata(hdev); 3646 3646 3647 - return !device_may_wakeup(&data->udev->dev); 3647 + return device_may_wakeup(&data->udev->dev); 3648 3648 } 3649 3649 3650 3650 static int btusb_shutdown_qca(struct hci_dev *hdev) ··· 3801 3801 hdev->flush = btusb_flush; 3802 3802 hdev->send = btusb_send_frame; 3803 3803 hdev->notify = btusb_notify; 3804 - hdev->prevent_wake = btusb_prevent_wake; 3804 + hdev->wakeup = btusb_wakeup; 3805 3805 3806 3806 #ifdef CONFIG_PM 3807 3807 err = btusb_config_oob_wake(hdev);
+2 -2
drivers/bluetooth/hci_qca.c
··· 1577 1577 mutex_unlock(&qca->hci_memdump_lock); 1578 1578 } 1579 1579 1580 - static bool qca_prevent_wake(struct hci_dev *hdev) 1580 + static bool qca_wakeup(struct hci_dev *hdev) 1581 1581 { 1582 1582 struct hci_uart *hu = hci_get_drvdata(hdev); 1583 1583 bool wakeup; ··· 1765 1765 qca_debugfs_init(hdev); 1766 1766 hu->hdev->hw_error = qca_hw_error; 1767 1767 hu->hdev->cmd_timeout = qca_cmd_timeout; 1768 - hu->hdev->prevent_wake = qca_prevent_wake; 1768 + hu->hdev->wakeup = qca_wakeup; 1769 1769 } else if (ret == -ENOENT) { 1770 1770 /* No patch/nvm-config found, run with original fw/config */ 1771 1771 set_bit(QCA_ROM_FW, &qca->flags);
+16 -16
drivers/bluetooth/hci_vhci.c
··· 40 40 struct delayed_work open_timeout; 41 41 42 42 bool suspended; 43 - bool prevent_wake; 43 + bool wakeup; 44 44 }; 45 45 46 46 static int vhci_open_dev(struct hci_dev *hdev) ··· 95 95 return 0; 96 96 } 97 97 98 - static bool vhci_prevent_wake(struct hci_dev *hdev) 98 + static bool vhci_wakeup(struct hci_dev *hdev) 99 99 { 100 100 struct vhci_data *data = hci_get_drvdata(hdev); 101 101 102 - return data->prevent_wake; 102 + return data->wakeup; 103 103 } 104 104 105 105 static ssize_t force_suspend_read(struct file *file, char __user *user_buf, ··· 149 149 .llseek = default_llseek, 150 150 }; 151 151 152 - static ssize_t force_prevent_wake_read(struct file *file, char __user *user_buf, 153 - size_t count, loff_t *ppos) 152 + static ssize_t force_wakeup_read(struct file *file, char __user *user_buf, 153 + size_t count, loff_t *ppos) 154 154 { 155 155 struct vhci_data *data = file->private_data; 156 156 char buf[3]; 157 157 158 - buf[0] = data->prevent_wake ? 'Y' : 'N'; 158 + buf[0] = data->wakeup ? 'Y' : 'N'; 159 159 buf[1] = '\n'; 160 160 buf[2] = '\0'; 161 161 return simple_read_from_buffer(user_buf, count, ppos, buf, 2); 162 162 } 163 163 164 - static ssize_t force_prevent_wake_write(struct file *file, 165 - const char __user *user_buf, 166 - size_t count, loff_t *ppos) 164 + static ssize_t force_wakeup_write(struct file *file, 165 + const char __user *user_buf, size_t count, 166 + loff_t *ppos) 167 167 { 168 168 struct vhci_data *data = file->private_data; 169 169 bool enable; ··· 173 173 if (err) 174 174 return err; 175 175 176 - if (data->prevent_wake == enable) 176 + if (data->wakeup == enable) 177 177 return -EALREADY; 178 178 179 179 return count; 180 180 } 181 181 182 - static const struct file_operations force_prevent_wake_fops = { 182 + static const struct file_operations force_wakeup_fops = { 183 183 .open = simple_open, 184 - .read = force_prevent_wake_read, 185 - .write = force_prevent_wake_write, 184 + .read = force_wakeup_read, 185 + .write = force_wakeup_write, 186 186 .llseek = default_llseek, 187 187 }; 188 188 ··· 227 227 hdev->send = vhci_send_frame; 228 228 hdev->get_data_path_id = vhci_get_data_path_id; 229 229 hdev->get_codec_config_data = vhci_get_codec_config_data; 230 - hdev->prevent_wake = vhci_prevent_wake; 230 + hdev->wakeup = vhci_wakeup; 231 231 232 232 /* bit 6 is for external configuration */ 233 233 if (opcode & 0x40) ··· 248 248 debugfs_create_file("force_suspend", 0644, hdev->debugfs, data, 249 249 &force_suspend_fops); 250 250 251 - debugfs_create_file("force_prevent_wake", 0644, hdev->debugfs, data, 252 - &force_prevent_wake_fops); 251 + debugfs_create_file("force_wakeup", 0644, hdev->debugfs, data, 252 + &force_wakeup_fops); 253 253 254 254 hci_skb_pkt_type(skb) = HCI_VENDOR_PKT; 255 255
+1 -1
include/net/bluetooth/hci_core.h
··· 617 617 int (*set_diag)(struct hci_dev *hdev, bool enable); 618 618 int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr); 619 619 void (*cmd_timeout)(struct hci_dev *hdev); 620 - bool (*prevent_wake)(struct hci_dev *hdev); 620 + bool (*wakeup)(struct hci_dev *hdev); 621 621 int (*set_quality_report)(struct hci_dev *hdev, bool enable); 622 622 int (*get_data_path_id)(struct hci_dev *hdev, __u8 *data_path); 623 623 int (*get_codec_config_data)(struct hci_dev *hdev, __u8 type,
+7 -6
net/bluetooth/hci_core.c
··· 3998 3998 * - Second, program event filter/accept list and enable scan 3999 3999 */ 4000 4000 ret = hci_change_suspend_state(hdev, BT_SUSPEND_DISCONNECT); 4001 - if (!ret) 4002 - state = BT_SUSPEND_DISCONNECT; 4001 + if (ret) 4002 + goto clear; 4003 4003 4004 - /* Only configure accept list if disconnect succeeded and wake 4005 - * isn't being prevented. 4006 - */ 4007 - if (!ret && !(hdev->prevent_wake && hdev->prevent_wake(hdev))) { 4004 + state = BT_SUSPEND_DISCONNECT; 4005 + 4006 + /* Only configure accept list if device may wakeup. */ 4007 + if (hdev->wakeup && hdev->wakeup(hdev)) { 4008 4008 ret = hci_change_suspend_state(hdev, BT_SUSPEND_CONFIGURE_WAKE); 4009 4009 if (!ret) 4010 4010 state = BT_SUSPEND_CONFIGURE_WAKE; 4011 4011 } 4012 4012 4013 + clear: 4013 4014 hci_clear_wake_reason(hdev); 4014 4015 mgmt_suspending(hdev, state); 4015 4016