Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e04b79c authored by Munir Contractor's avatar Munir Contractor Committed by Dmitry Torokhov
Browse files

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: default avatarMunir Contractor <munircontractor@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 2e53d52c
Loading
Loading
Loading
Loading
+11 −6
Original line number Original line Diff line number Diff line
@@ -18,25 +18,30 @@
#include <linux/input.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/timex.h>
#include <linux/timex.h>
#include <asm/io.h>
#include <linux/io.h>


MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("PC Speaker beeper driver");
MODULE_DESCRIPTION("PC Speaker beeper driver");
MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:pcspkr");
MODULE_ALIAS("platform:pcspkr");


static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
static int pcspkr_event(struct input_dev *dev, unsigned int type,
			unsigned int code, int value)
{
{
	unsigned int count = 0;
	unsigned int count = 0;
	unsigned long flags;
	unsigned long flags;


	if (type != EV_SND)
	if (type != EV_SND)
		return -1;
		return -EINVAL;


	switch (code) {
	switch (code) {
		case SND_BELL: if (value) value = 1000;
	case SND_BELL:
		case SND_TONE: break;
		if (value)
		default: return -1;
			value = 1000;
	case SND_TONE:
		break;
	default:
		return -EINVAL;
	}
	}


	if (value > 20 && value < 32767)
	if (value > 20 && value < 32767)