diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-14 00:55:03 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:24 -0500 |
commit | d4b778d36889b4d51d79a99f8a96e110def8541c (patch) | |
tree | 641bb024dabf3785cb7cfce53a1e95d69153be00 /drivers/media/IR | |
parent | 950b0f5a0bf764663a6aa4397d105ad571c64a83 (diff) |
V4L/DVB (13638): ir-core: documment missed functions
While here, change ir_core_dev_number to be static
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR')
-rw-r--r-- | drivers/media/IR/ir-keytable.c | 13 | ||||
-rw-r--r-- | drivers/media/IR/ir-sysfs.c | 50 |
2 files changed, 56 insertions, 7 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index b2d498c3183a..68aceb8d63a9 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c | |||
@@ -402,9 +402,10 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); | |||
402 | * @input_dev: the struct input_dev descriptor of the device | 402 | * @input_dev: the struct input_dev descriptor of the device |
403 | * @rc_tab: the struct ir_scancode_table table of scancode/keymap | 403 | * @rc_tab: the struct ir_scancode_table table of scancode/keymap |
404 | * | 404 | * |
405 | * This routine is used to initialize the input infrastructure to work with | 405 | * This routine is used to initialize the input infrastructure |
406 | * an IR. | 406 | * to work with an IR. |
407 | * It should be called before registering the IR device. | 407 | * It will register the input/evdev interface for the device and |
408 | * register the syfs code for IR class | ||
408 | */ | 409 | */ |
409 | int ir_input_register(struct input_dev *input_dev, | 410 | int ir_input_register(struct input_dev *input_dev, |
410 | const struct ir_scancode_table *rc_tab, | 411 | const struct ir_scancode_table *rc_tab, |
@@ -471,6 +472,12 @@ err: | |||
471 | } | 472 | } |
472 | EXPORT_SYMBOL_GPL(ir_input_register); | 473 | EXPORT_SYMBOL_GPL(ir_input_register); |
473 | 474 | ||
475 | /** | ||
476 | * ir_input_unregister() - unregisters IR and frees resources | ||
477 | * @input_dev: the struct input_dev descriptor of the device | ||
478 | |||
479 | * This routine is used to free memory and de-register interfaces. | ||
480 | */ | ||
474 | void ir_input_unregister(struct input_dev *dev) | 481 | void ir_input_unregister(struct input_dev *dev) |
475 | { | 482 | { |
476 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); | 483 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); |
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index aede78ddbace..a96738135bb0 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c | |||
@@ -18,11 +18,22 @@ | |||
18 | 18 | ||
19 | #define IRRCV_NUM_DEVICES 256 | 19 | #define IRRCV_NUM_DEVICES 256 |
20 | 20 | ||
21 | unsigned long ir_core_dev_number; | 21 | /* bit array to represent IR sysfs device number */ |
22 | static unsigned long ir_core_dev_number; | ||
22 | 23 | ||
24 | /* class for /sys/class/irrcv */ | ||
23 | static struct class *ir_input_class; | 25 | static struct class *ir_input_class; |
24 | 26 | ||
25 | 27 | /** | |
28 | * show_protocol() - shows the current IR protocol | ||
29 | * @d: the device descriptor | ||
30 | * @mattr: the device attribute struct (unused) | ||
31 | * @buf: a pointer to the output buffer | ||
32 | * | ||
33 | * This routine is a callback routine for input read the IR protocol type. | ||
34 | * it is trigged by reading /sys/class/irrcv/irrcv?/current_protocol. | ||
35 | * It returns the protocol name, as understood by the driver. | ||
36 | */ | ||
26 | static ssize_t show_protocol(struct device *d, | 37 | static ssize_t show_protocol(struct device *d, |
27 | struct device_attribute *mattr, char *buf) | 38 | struct device_attribute *mattr, char *buf) |
28 | { | 39 | { |
@@ -47,7 +58,19 @@ static ssize_t show_protocol(struct device *d, | |||
47 | return sprintf(buf, "%s\n", s); | 58 | return sprintf(buf, "%s\n", s); |
48 | } | 59 | } |
49 | 60 | ||
50 | 61 | /** | |
62 | * store_protocol() - shows the current IR protocol | ||
63 | * @d: the device descriptor | ||
64 | * @mattr: the device attribute struct (unused) | ||
65 | * @buf: a pointer to the input buffer | ||
66 | * @len: length of the input buffer | ||
67 | * | ||
68 | * This routine is a callback routine for changing the IR protocol type. | ||
69 | * it is trigged by reading /sys/class/irrcv/irrcv?/current_protocol. | ||
70 | * It changes the IR the protocol name, if the IR type is recognized | ||
71 | * by the driver. | ||
72 | * If an unknown protocol name is used, returns -EINVAL. | ||
73 | */ | ||
51 | static ssize_t store_protocol(struct device *d, | 74 | static ssize_t store_protocol(struct device *d, |
52 | struct device_attribute *mattr, | 75 | struct device_attribute *mattr, |
53 | const char *data, | 76 | const char *data, |
@@ -88,7 +111,9 @@ static ssize_t store_protocol(struct device *d, | |||
88 | return len; | 111 | return len; |
89 | } | 112 | } |
90 | 113 | ||
91 | 114 | /* | |
115 | * Static device attribute struct with the sysfs attributes for IR's | ||
116 | */ | ||
92 | static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR, | 117 | static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR, |
93 | show_protocol, store_protocol); | 118 | show_protocol, store_protocol); |
94 | 119 | ||
@@ -96,6 +121,12 @@ static struct attribute *ir_dev_attrs[] = { | |||
96 | &dev_attr_current_protocol.attr, | 121 | &dev_attr_current_protocol.attr, |
97 | }; | 122 | }; |
98 | 123 | ||
124 | /** | ||
125 | * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv? | ||
126 | * @input_dev: the struct input_dev descriptor of the device | ||
127 | * | ||
128 | * This routine is used to register the syfs code for IR class | ||
129 | */ | ||
99 | int ir_register_class(struct input_dev *input_dev) | 130 | int ir_register_class(struct input_dev *input_dev) |
100 | { | 131 | { |
101 | int rc; | 132 | int rc; |
@@ -127,6 +158,13 @@ int ir_register_class(struct input_dev *input_dev) | |||
127 | return 0; | 158 | return 0; |
128 | }; | 159 | }; |
129 | 160 | ||
161 | /** | ||
162 | * ir_unregister_class() - removes the sysfs for sysfs for | ||
163 | * /sys/class/irrcv/irrcv? | ||
164 | * @input_dev: the struct input_dev descriptor of the device | ||
165 | * | ||
166 | * This routine is used to unregister the syfs code for IR class | ||
167 | */ | ||
130 | void ir_unregister_class(struct input_dev *input_dev) | 168 | void ir_unregister_class(struct input_dev *input_dev) |
131 | { | 169 | { |
132 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | 170 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); |
@@ -142,6 +180,10 @@ void ir_unregister_class(struct input_dev *input_dev) | |||
142 | kfree(ir_dev->attr.name); | 180 | kfree(ir_dev->attr.name); |
143 | } | 181 | } |
144 | 182 | ||
183 | /* | ||
184 | * Init/exit code for the module. Basically, creates/removes /sys/class/irrcv | ||
185 | */ | ||
186 | |||
145 | static int __init ir_core_init(void) | 187 | static int __init ir_core_init(void) |
146 | { | 188 | { |
147 | ir_input_class = class_create(THIS_MODULE, "irrcv"); | 189 | ir_input_class = class_create(THIS_MODULE, "irrcv"); |