Bluetooth: Move idle_timeout and sniff_{min,max}_interval to hci_core.c
Subsystems (2)
Marcel Holtmann
maintainerPATCH 1/1 Bluetooth: Move idle_timeout and sniff_{min,max}_interval to hci_core.c
Move the debugfs configuration directly into hci_core.c and only expose it when the controller actually support BR/EDR sniff power saving mode.
Signed-off-by Marcel Holtmann <[email protected]>
--- net/bluetooth/hci_core.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++ net/bluetooth/hci_sysfs.c | 91 ---------------------------------------------- 2 files changed, 93 insertions(+), 91 deletions(-)
net/bluetooth/hci_core.c +93 -0
@@ -195,6 +195,90 @@ static int auto_accept_delay_get(void *data, u64 *val)DEFINE_SIMPLE_ATTRIBUTE (auto_accept_delay_fops, auto_accept_delay_get, auto_accept_delay_set,"%llu\n" ); +static int idle_timeout_set (void *data,u64 val) +{ +struct hci_dev *hdev = data; + +if (val !=0 && (val <500 || val >3600000 )) +return -EINVAL ; + +hci_dev_lock (hdev); + hdev->idle_timeout= val; +hci_dev_unlock (hdev); + +return 0 ; +} + +static int idle_timeout_get (void *data,u64 *val) +{ +struct hci_dev *hdev = data; + +hci_dev_lock (hdev); + *val = hdev->idle_timeout; +hci_dev_unlock (hdev); + +return 0 ; +} + +DEFINE_SIMPLE_ATTRIBUTE (idle_timeout_fops, idle_timeout_get, + idle_timeout_set,"%llu\n" ); + +static int sniff_min_interval_set (void *data,u64 val) +{ +struct hci_dev *hdev = data; + +if (val ==0 || val %2 || val > hdev->sniff_max_interval) +return -EINVAL ; + +hci_dev_lock (hdev); + hdev->sniff_min_interval= val; +hci_dev_unlock (hdev); + +return 0 ; +} + +static int sniff_min_interval_get (void *data,u64 *val) +{ +struct hci_dev *hdev = data; + +hci_dev_lock (hdev); + *val = hdev->sniff_min_interval; +hci_dev_unlock (hdev); + +return 0 ; +} + +DEFINE_SIMPLE_ATTRIBUTE (sniff_min_interval_fops, sniff_min_interval_get, + sniff_min_interval_set,"%llu\n" ); + +static int sniff_max_interval_set (void *data,u64 val) +{ +struct hci_dev *hdev = data; + +if (val ==0 || val %2 || val < hdev->sniff_min_interval) +return -EINVAL ; + +hci_dev_lock (hdev); + hdev->sniff_max_interval= val; +hci_dev_unlock (hdev); + +return 0 ; +} + +static int sniff_max_interval_get (void *data,u64 *val) +{ +struct hci_dev *hdev = data; + +hci_dev_lock (hdev); + *val = hdev->sniff_max_interval; +hci_dev_unlock (hdev); + +return 0 ; +} + +DEFINE_SIMPLE_ATTRIBUTE (sniff_max_interval_fops, sniff_max_interval_get, + sniff_max_interval_set,"%llu\n" ); +static int static_address_show (struct seq_file *f,void *p) {struct hci_dev *hdev = f->private;
@@ -923,6 +1007,15 @@ static int __hci_init(struct hci_dev *hdev)debugfs_create_file ("auto_accept_delay" ,0644 , hdev->debugfs, hdev, &auto_accept_delay_fops); +if (lmp_sniff_capable (hdev)) { +debugfs_create_file ("idle_timeout" ,0644 , hdev->debugfs, + hdev, &idle_timeout_fops); +debugfs_create_file ("sniff_min_interval" ,0644 , hdev->debugfs, + hdev, &sniff_min_interval_fops); +debugfs_create_file ("sniff_max_interval" ,0644 , hdev->debugfs, + hdev, &sniff_max_interval_fops); + } +if (lmp_le_capable (hdev))debugfs_create_file ("static_address" ,0444 , hdev->debugfs, hdev, &static_address_fops);
net/bluetooth/hci_sysfs.c +0 -91
109 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Johan Hedberg
AppliedHi Marcel,
Quoted 8 lines · Marcel Holtmann
Move the debugfs configuration directly into
hci_core.cand only expose it when the controller actually support BR/EDR sniff power saving mode.Signed-off-by Marcel Holtmann <[email protected]>--- net/bluetooth/hci_core.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++ net/bluetooth/hci_sysfs.c | 91 ---------------------------------------------- 2 files changed, 93 insertions(+), 91 deletions(-)
Applied to bluetooth-next. Thanks.
Johan