Bluetooth: Fix coding style in hci_sysfs.c
Follow the net subsystem rules. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
3bb3c7551c
commit
b80f021f70
|
@ -31,27 +31,30 @@ static inline char *link_typetostr(int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_link_type(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_link_type(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_conn *conn = to_hci_conn(dev);
|
struct hci_conn *conn = to_hci_conn(dev);
|
||||||
return sprintf(buf, "%s\n", link_typetostr(conn->type));
|
return sprintf(buf, "%s\n", link_typetostr(conn->type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_link_address(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_link_address(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_conn *conn = to_hci_conn(dev);
|
struct hci_conn *conn = to_hci_conn(dev);
|
||||||
return sprintf(buf, "%s\n", batostr(&conn->dst));
|
return sprintf(buf, "%s\n", batostr(&conn->dst));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_link_features(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_link_features(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_conn *conn = to_hci_conn(dev);
|
struct hci_conn *conn = to_hci_conn(dev);
|
||||||
|
|
||||||
return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
||||||
conn->features[0], conn->features[1],
|
conn->features[0], conn->features[1],
|
||||||
conn->features[2], conn->features[3],
|
conn->features[2], conn->features[3],
|
||||||
conn->features[4], conn->features[5],
|
conn->features[4], conn->features[5],
|
||||||
conn->features[6], conn->features[7]);
|
conn->features[6], conn->features[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LINK_ATTR(_name, _mode, _show, _store) \
|
#define LINK_ATTR(_name, _mode, _show, _store) \
|
||||||
|
@ -185,19 +188,22 @@ static inline char *host_typetostr(int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_bus(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%s\n", host_bustostr(hdev->bus));
|
return sprintf(buf, "%s\n", host_bustostr(hdev->bus));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_type(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type));
|
return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_name(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
char name[HCI_MAX_NAME_LENGTH + 1];
|
char name[HCI_MAX_NAME_LENGTH + 1];
|
||||||
|
@ -210,55 +216,64 @@ static ssize_t show_name(struct device *dev, struct device_attribute *attr, char
|
||||||
return sprintf(buf, "%s\n", name);
|
return sprintf(buf, "%s\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_class(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_class(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "0x%.2x%.2x%.2x\n",
|
return sprintf(buf, "0x%.2x%.2x%.2x\n",
|
||||||
hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]);
|
hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_address(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%s\n", batostr(&hdev->bdaddr));
|
return sprintf(buf, "%s\n", batostr(&hdev->bdaddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_features(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_features(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
|
|
||||||
return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
||||||
hdev->features[0], hdev->features[1],
|
hdev->features[0], hdev->features[1],
|
||||||
hdev->features[2], hdev->features[3],
|
hdev->features[2], hdev->features[3],
|
||||||
hdev->features[4], hdev->features[5],
|
hdev->features[4], hdev->features[5],
|
||||||
hdev->features[6], hdev->features[7]);
|
hdev->features[6], hdev->features[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_manufacturer(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_manufacturer(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%d\n", hdev->manufacturer);
|
return sprintf(buf, "%d\n", hdev->manufacturer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_hci_version(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_hci_version(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%d\n", hdev->hci_ver);
|
return sprintf(buf, "%d\n", hdev->hci_ver);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_hci_revision(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_hci_revision(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%d\n", hdev->hci_rev);
|
return sprintf(buf, "%d\n", hdev->hci_rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_idle_timeout(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%d\n", hdev->idle_timeout);
|
return sprintf(buf, "%d\n", hdev->idle_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
|
static ssize_t store_idle_timeout(struct device *dev,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
@ -276,13 +291,16 @@ static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *a
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_sniff_max_interval(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%d\n", hdev->sniff_max_interval);
|
return sprintf(buf, "%d\n", hdev->sniff_max_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t store_sniff_max_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
|
static ssize_t store_sniff_max_interval(struct device *dev,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
u16 val;
|
u16 val;
|
||||||
|
@ -300,13 +318,16 @@ static ssize_t store_sniff_max_interval(struct device *dev, struct device_attrib
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_sniff_min_interval(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_sniff_min_interval(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
return sprintf(buf, "%d\n", hdev->sniff_min_interval);
|
return sprintf(buf, "%d\n", hdev->sniff_min_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t store_sniff_min_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
|
static ssize_t store_sniff_min_interval(struct device *dev,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = to_hci_dev(dev);
|
struct hci_dev *hdev = to_hci_dev(dev);
|
||||||
u16 val;
|
u16 val;
|
||||||
|
@ -335,11 +356,11 @@ static DEVICE_ATTR(hci_version, S_IRUGO, show_hci_version, NULL);
|
||||||
static DEVICE_ATTR(hci_revision, S_IRUGO, show_hci_revision, NULL);
|
static DEVICE_ATTR(hci_revision, S_IRUGO, show_hci_revision, NULL);
|
||||||
|
|
||||||
static DEVICE_ATTR(idle_timeout, S_IRUGO | S_IWUSR,
|
static DEVICE_ATTR(idle_timeout, S_IRUGO | S_IWUSR,
|
||||||
show_idle_timeout, store_idle_timeout);
|
show_idle_timeout, store_idle_timeout);
|
||||||
static DEVICE_ATTR(sniff_max_interval, S_IRUGO | S_IWUSR,
|
static DEVICE_ATTR(sniff_max_interval, S_IRUGO | S_IWUSR,
|
||||||
show_sniff_max_interval, store_sniff_max_interval);
|
show_sniff_max_interval, store_sniff_max_interval);
|
||||||
static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR,
|
static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR,
|
||||||
show_sniff_min_interval, store_sniff_min_interval);
|
show_sniff_min_interval, store_sniff_min_interval);
|
||||||
|
|
||||||
static struct attribute *bt_host_attrs[] = {
|
static struct attribute *bt_host_attrs[] = {
|
||||||
&dev_attr_bus.attr,
|
&dev_attr_bus.attr,
|
||||||
|
@ -455,8 +476,8 @@ static void print_bt_uuid(struct seq_file *f, u8 *uuid)
|
||||||
memcpy(&data5, &uuid[14], 2);
|
memcpy(&data5, &uuid[14], 2);
|
||||||
|
|
||||||
seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x\n",
|
seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x\n",
|
||||||
ntohl(data0), ntohs(data1), ntohs(data2),
|
ntohl(data0), ntohs(data1), ntohs(data2), ntohs(data3),
|
||||||
ntohs(data3), ntohl(data4), ntohs(data5));
|
ntohl(data4), ntohs(data5));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int uuids_show(struct seq_file *f, void *p)
|
static int uuids_show(struct seq_file *f, void *p)
|
||||||
|
@ -513,7 +534,7 @@ static int auto_accept_delay_get(void *data, u64 *val)
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get,
|
DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get,
|
||||||
auto_accept_delay_set, "%llu\n");
|
auto_accept_delay_set, "%llu\n");
|
||||||
|
|
||||||
void hci_init_sysfs(struct hci_dev *hdev)
|
void hci_init_sysfs(struct hci_dev *hdev)
|
||||||
{
|
{
|
||||||
|
@ -547,15 +568,15 @@ int hci_add_sysfs(struct hci_dev *hdev)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
debugfs_create_file("inquiry_cache", 0444, hdev->debugfs,
|
debugfs_create_file("inquiry_cache", 0444, hdev->debugfs,
|
||||||
hdev, &inquiry_cache_fops);
|
hdev, &inquiry_cache_fops);
|
||||||
|
|
||||||
debugfs_create_file("blacklist", 0444, hdev->debugfs,
|
debugfs_create_file("blacklist", 0444, hdev->debugfs,
|
||||||
hdev, &blacklist_fops);
|
hdev, &blacklist_fops);
|
||||||
|
|
||||||
debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops);
|
debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops);
|
||||||
|
|
||||||
debugfs_create_file("auto_accept_delay", 0444, hdev->debugfs, hdev,
|
debugfs_create_file("auto_accept_delay", 0444, hdev->debugfs, hdev,
|
||||||
&auto_accept_delay_fops);
|
&auto_accept_delay_fops);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue