summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMunir Contractor <munircontractor@gmail.com>2017-08-15 01:02:08 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-08-15 01:12:05 -0400
commit9e04b79ce432b8be2419dc52021afb6f07b78540 (patch)
tree64228b20e4d7e59fc7b64a6eff65469b2fb0f279
parent2e53d52c0108f03fb9fc67419c20a0b31acade52 (diff)
Input: pcspkr - fix code style and error value in pcspkr_event
This patch fixes the following issues in pcspkr: * Return -EINVAL when input arguments are not valid in pcspkr_event function instead of -1. * Replace <asm/io.h> with <linux/io.h> * Fix indentation of case blocks in switch statement * Reduce length of line 28 to less than 80 characters The style issues were discovered by checkpatch.pl script. Signed-off-by: Munir Contractor <munircontractor@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/misc/pcspkr.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index 72b1fc3ab910..56ddba21de84 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -18,25 +18,30 @@
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/timex.h> 20#include <linux/timex.h>
21#include <asm/io.h> 21#include <linux/io.h>
22 22
23MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 23MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
24MODULE_DESCRIPTION("PC Speaker beeper driver"); 24MODULE_DESCRIPTION("PC Speaker beeper driver");
25MODULE_LICENSE("GPL"); 25MODULE_LICENSE("GPL");
26MODULE_ALIAS("platform:pcspkr"); 26MODULE_ALIAS("platform:pcspkr");
27 27
28static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 28static int pcspkr_event(struct input_dev *dev, unsigned int type,
29 unsigned int code, int value)
29{ 30{
30 unsigned int count = 0; 31 unsigned int count = 0;
31 unsigned long flags; 32 unsigned long flags;
32 33
33 if (type != EV_SND) 34 if (type != EV_SND)
34 return -1; 35 return -EINVAL;
35 36
36 switch (code) { 37 switch (code) {
37 case SND_BELL: if (value) value = 1000; 38 case SND_BELL:
38 case SND_TONE: break; 39 if (value)
39 default: return -1; 40 value = 1000;
41 case SND_TONE:
42 break;
43 default:
44 return -EINVAL;
40 } 45 }
41 46
42 if (value > 20 && value < 32767) 47 if (value > 20 && value < 32767)