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

Commit 7b19ada2 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds
Browse files

get rid of input BIT* duplicate defines



get rid of input BIT* duplicate defines

use newly global defined macros for input layer. Also remove includes of
input.h from non-input sources only for BIT macro definiton. Define the
macro temporarily in local manner, all those local definitons will be
removed further in this patchset (to not break bisecting).
BIT macro will be globally defined (1<<x)

Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: <dtor@mail.ru>
Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
Cc: <lenb@kernel.org>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Cc: <perex@suse.cz>
Acked-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
Cc: <vernux@us.ibm.com>
Cc: <malattia@linux.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d05be13b
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -42,8 +42,8 @@ static int __init button_init(void)
		goto err_free_irq;
	}

	button_dev->evbit[0] = BIT(EV_KEY);
	button_dev->keybit[LONG(BTN_0)] = BIT(BTN_0);
	button_dev->evbit[0] = BIT_MASK(EV_KEY);
	button_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);

	error = input_register_device(button_dev);
	if (error) {
@@ -217,14 +217,15 @@ If you don't need absfuzz and absflat, you can set them to zero, which mean
that the thing is precise and always returns to exactly the center position
(if it has any).

1.4 NBITS(), LONG(), BIT()
1.4 BITS_TO_LONGS(), BIT_WORD(), BIT_MASK()
~~~~~~~~~~~~~~~~~~~~~~~~~~

These three macros from input.h help some bitfield computations:
These three macros from bitops.h help some bitfield computations:

	NBITS(x) - returns the length of a bitfield array in longs for x bits
	LONG(x)  - returns the index in the array in longs for bit x
	BIT(x)   - returns the index in a long for bit x
	BITS_TO_LONGS(x) - returns the length of a bitfield array in longs for
			   x bits
	BIT_WORD(x)	 - returns the index in the array in longs for bit x
	BIT_MASK(x)	 - returns the index in a long for bit x

1.5 The id* and name fields
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+3 −3
Original line number Diff line number Diff line
@@ -434,18 +434,18 @@ static int acpi_button_add(struct acpi_device *device)
	switch (button->type) {
	case ACPI_BUTTON_TYPE_POWER:
	case ACPI_BUTTON_TYPE_POWERF:
		input->evbit[0] = BIT(EV_KEY);
		input->evbit[0] = BIT_MASK(EV_KEY);
		set_bit(KEY_POWER, input->keybit);
		break;

	case ACPI_BUTTON_TYPE_SLEEP:
	case ACPI_BUTTON_TYPE_SLEEPF:
		input->evbit[0] = BIT(EV_KEY);
		input->evbit[0] = BIT_MASK(EV_KEY);
		set_bit(KEY_SLEEP, input->keybit);
		break;

	case ACPI_BUTTON_TYPE_LID:
		input->evbit[0] = BIT(EV_SW);
		input->evbit[0] = BIT_MASK(EV_SW);
		set_bit(SW_LID, input->swbit);
		break;
	}
+3 −3
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ int shift_state = 0;
 */

static struct input_handler kbd_handler;
static unsigned long key_down[NBITS(KEY_MAX)];		/* keyboard key bitmap */
static unsigned long key_down[BITS_TO_LONGS(KEY_CNT)];	/* keyboard key bitmap */
static unsigned char shift_down[NR_SHIFT];		/* shift state counters.. */
static int dead_key_next;
static int npadch = -1;					/* -1 or number assembled on pad */
@@ -1377,12 +1377,12 @@ static void kbd_start(struct input_handle *handle)
static const struct input_device_id kbd_ids[] = {
	{
                .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
                .evbit = { BIT(EV_KEY) },
                .evbit = { BIT_MASK(EV_KEY) },
        },

	{
                .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
                .evbit = { BIT(EV_SND) },
                .evbit = { BIT_MASK(EV_SND) },
        },

	{ },    /* Terminating entry */
+4 −4
Original line number Diff line number Diff line
@@ -1178,9 +1178,9 @@ static int __devinit sonypi_create_input_devices(void)
	jog_dev->id.bustype = BUS_ISA;
	jog_dev->id.vendor = PCI_VENDOR_ID_SONY;

	jog_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
	jog_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_MIDDLE);
	jog_dev->relbit[0] = BIT(REL_WHEEL);
	jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
	jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE);
	jog_dev->relbit[0] = BIT_MASK(REL_WHEEL);

	sonypi_device.input_key_dev = key_dev = input_allocate_device();
	if (!key_dev) {
@@ -1193,7 +1193,7 @@ static int __devinit sonypi_create_input_devices(void)
	key_dev->id.vendor = PCI_VENDOR_ID_SONY;

	/* Initialize the Input Drivers: special keys */
	key_dev->evbit[0] = BIT(EV_KEY);
	key_dev->evbit[0] = BIT_MASK(EV_KEY);
	for (i = 0; sonypi_inputkeys[i].sonypiev; i++)
		if (sonypi_inputkeys[i].inputev)
			set_bit(sonypi_inputkeys[i].inputev, key_dev->keybit);
+2 −1
Original line number Diff line number Diff line
@@ -17,10 +17,11 @@
#define _DCDBAS_H_

#include <linux/device.h>
#include <linux/input.h>
#include <linux/sysfs.h>
#include <linux/types.h>

#define BIT(x)					(1UL << x)

#define MAX_SMI_DATA_BUF_SIZE			(256 * 1024)

#define HC_ACTION_NONE				(0)
Loading