Linux Audio

Check our new training course

Linux kernel drivers training

Mar 31-Apr 9, 2025, special US time zones
Register
Loading...
v4.17
 
 1/*
 2 * Intel Wireless WiMAX Connection 2400m
 3 * Sysfs interfaces to show driver and device information
 4 *
 5 *
 6 * Copyright (C) 2007 Intel Corporation <linux-wimax@intel.com>
 7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
 8 *
 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 */
23
24#include <linux/netdevice.h>
25#include <linux/etherdevice.h>
26#include <linux/spinlock.h>
27#include <linux/device.h>
28#include "i2400m.h"
29
30
31#define D_SUBMODULE sysfs
32#include "debug-levels.h"
33
34
35/*
36 * Set the idle timeout (msecs)
37 *
38 * FIXME: eventually this should be a common WiMAX stack method, but
39 * would like to wait to see how other devices manage it.
40 */
41static
42ssize_t i2400m_idle_timeout_store(struct device *dev,
43				  struct device_attribute *attr,
44				  const char *buf, size_t size)
45{
46	ssize_t result;
47	struct i2400m *i2400m = net_dev_to_i2400m(to_net_dev(dev));
48	unsigned val;
49
50	result = -EINVAL;
51	if (sscanf(buf, "%u\n", &val) != 1)
52		goto error_no_unsigned;
53	if (val != 0 && (val < 100 || val > 300000 || val % 100 != 0)) {
54		dev_err(dev, "idle_timeout: %u: invalid msecs specification; "
55			"valid values are 0, 100-300000 in 100 increments\n",
56			val);
57		goto error_bad_value;
58	}
59	result = i2400m_set_idle_timeout(i2400m, val);
60	if (result >= 0)
61		result = size;
62error_no_unsigned:
63error_bad_value:
64	return result;
65}
66
67static
68DEVICE_ATTR_WO(i2400m_idle_timeout);
69
70static
71struct attribute *i2400m_dev_attrs[] = {
72	&dev_attr_i2400m_idle_timeout.attr,
73	NULL,
74};
75
76struct attribute_group i2400m_dev_attr_group = {
77	.name = NULL,		/* we want them in the same directory */
78	.attrs = i2400m_dev_attrs,
79};
v5.9
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * Intel Wireless WiMAX Connection 2400m
 4 * Sysfs interfaces to show driver and device information
 5 *
 
 6 * Copyright (C) 2007 Intel Corporation <linux-wimax@intel.com>
 7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 8 */
 9
10#include <linux/netdevice.h>
11#include <linux/etherdevice.h>
12#include <linux/spinlock.h>
13#include <linux/device.h>
14#include "i2400m.h"
15
16
17#define D_SUBMODULE sysfs
18#include "debug-levels.h"
19
20
21/*
22 * Set the idle timeout (msecs)
23 *
24 * FIXME: eventually this should be a common WiMAX stack method, but
25 * would like to wait to see how other devices manage it.
26 */
27static
28ssize_t i2400m_idle_timeout_store(struct device *dev,
29				  struct device_attribute *attr,
30				  const char *buf, size_t size)
31{
32	ssize_t result;
33	struct i2400m *i2400m = net_dev_to_i2400m(to_net_dev(dev));
34	unsigned val;
35
36	result = -EINVAL;
37	if (sscanf(buf, "%u\n", &val) != 1)
38		goto error_no_unsigned;
39	if (val != 0 && (val < 100 || val > 300000 || val % 100 != 0)) {
40		dev_err(dev, "idle_timeout: %u: invalid msecs specification; "
41			"valid values are 0, 100-300000 in 100 increments\n",
42			val);
43		goto error_bad_value;
44	}
45	result = i2400m_set_idle_timeout(i2400m, val);
46	if (result >= 0)
47		result = size;
48error_no_unsigned:
49error_bad_value:
50	return result;
51}
52
53static
54DEVICE_ATTR_WO(i2400m_idle_timeout);
55
56static
57struct attribute *i2400m_dev_attrs[] = {
58	&dev_attr_i2400m_idle_timeout.attr,
59	NULL,
60};
61
62struct attribute_group i2400m_dev_attr_group = {
63	.name = NULL,		/* we want them in the same directory */
64	.attrs = i2400m_dev_attrs,
65};