Skip to content

Commit a534169

Browse files
committed
input: rename callback define macro to INPUT_CALLBACK_DEFINE
Looking back at the current INPUT_LISTENER_CB_DEFINE api naming, it feels like it's a bit overloaded. Rename it to a simpler INPUT_CALLBACK_DEFINE. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
1 parent f24dc9e commit a534169

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

doc/services/input/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Application API
3838
***************
3939

4040
An application can register a callback using the
41-
:c:macro:`INPUT_LISTENER_CB_DEFINE` macro. If a device node is specified, the
41+
:c:macro:`INPUT_CALLBACK_DEFINE` macro. If a device node is specified, the
4242
callback is only invoked for events from the specific device, otherwise the
4343
callback will receive all the events in the system. This is the only type of
4444
filtering supported, any more complex filtering logic has to be implemented in

drivers/kscan/kscan_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ static const struct kscan_driver_api kscan_input_driver_api = {
105105
kscan_input_cb(DEVICE_DT_GET(DT_INST(index, DT_DRV_COMPAT)), \
106106
evt); \
107107
} \
108-
INPUT_LISTENER_CB_DEFINE(DEVICE_DT_GET(DT_INST_PARENT(index)), \
109-
kscan_input_cb_##index); \
108+
INPUT_CALLBACK_DEFINE(DEVICE_DT_GET(DT_INST_PARENT(index)), \
109+
kscan_input_cb_##index); \
110110
static const struct kscan_input_config kscan_input_config_##index = { \
111111
.input_dev = DEVICE_DT_GET(DT_INST_PARENT(index)), \
112112
}; \

include/zephyr/input/input.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ struct input_listener {
135135
* @param _dev @ref device pointer or NULL.
136136
* @param _callback The callback function.
137137
*/
138-
#define INPUT_LISTENER_CB_DEFINE(_dev, _callback) \
138+
#define INPUT_CALLBACK_DEFINE(_dev, _callback) \
139139
static const STRUCT_SECTION_ITERABLE(input_listener, \
140140
_input_listener__##_callback) = { \
141141
.dev = _dev, \

subsys/input/input_longpress.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ static int longpress_init(const struct device *dev)
116116
{ \
117117
longpress_cb(DEVICE_DT_INST_GET(inst), evt); \
118118
} \
119-
INPUT_LISTENER_CB_DEFINE(DEVICE_DT_GET_OR_NULL(DT_INST_PHANDLE(inst, input)), \
120-
longpress_cb_##inst); \
119+
INPUT_CALLBACK_DEFINE(DEVICE_DT_GET_OR_NULL(DT_INST_PHANDLE(inst, input)), \
120+
longpress_cb_##inst); \
121121
static const uint16_t longpress_input_codes_##inst[] = DT_INST_PROP(inst, input_codes); \
122122
static const uint16_t longpress_short_codes_##inst[] = DT_INST_PROP(inst, short_codes); \
123123
static const uint16_t longpress_long_codes_##inst[] = DT_INST_PROP(inst, long_codes); \

subsys/input/input_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void input_cb(struct input_event *evt)
6060
evt->code,
6161
evt->value);
6262
}
63-
INPUT_LISTENER_CB_DEFINE(NULL, input_cb);
63+
INPUT_CALLBACK_DEFINE(NULL, input_cb);
6464
#endif /* CONFIG_INPUT_EVENT_DUMP */
6565

6666
#ifdef CONFIG_INPUT_SHELL

tests/drivers/input/gpio_keys/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static void test_gpio_keys_cb_handler(struct input_event *evt)
4343
last_code = evt->code;
4444
last_val = evt->value;
4545
}
46-
INPUT_LISTENER_CB_DEFINE(test_gpio_keys_dev, test_gpio_keys_cb_handler);
46+
INPUT_CALLBACK_DEFINE(test_gpio_keys_dev, test_gpio_keys_cb_handler);
4747

4848
/**
4949
* @brief TestPurpose: Verify gpio_keys_config pressed raw.

tests/subsys/input/api/src/main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static void input_cb_filtered(struct input_event *evt)
2929

3030
k_sem_give(&cb_start);
3131
}
32-
INPUT_LISTENER_CB_DEFINE(&fake_dev, input_cb_filtered);
32+
INPUT_CALLBACK_DEFINE(&fake_dev, input_cb_filtered);
3333

3434
static void input_cb_unfiltered(struct input_event *evt)
3535
{
@@ -42,7 +42,7 @@ static void input_cb_unfiltered(struct input_event *evt)
4242
k_sem_give(&cb_done);
4343
}
4444
}
45-
INPUT_LISTENER_CB_DEFINE(NULL, input_cb_unfiltered);
45+
INPUT_CALLBACK_DEFINE(NULL, input_cb_unfiltered);
4646

4747
ZTEST(input_api, test_sequence_thread)
4848
{
@@ -91,13 +91,13 @@ static void input_cb_filtered(struct input_event *evt)
9191
message_count_filtered++;
9292
}
9393
}
94-
INPUT_LISTENER_CB_DEFINE(&fake_dev, input_cb_filtered);
94+
INPUT_CALLBACK_DEFINE(&fake_dev, input_cb_filtered);
9595

9696
static void input_cb_unfiltered(struct input_event *evt)
9797
{
9898
message_count_unfiltered++;
9999
}
100-
INPUT_LISTENER_CB_DEFINE(NULL, input_cb_unfiltered);
100+
INPUT_CALLBACK_DEFINE(NULL, input_cb_unfiltered);
101101

102102
ZTEST(input_api, test_synchronous)
103103
{
@@ -122,7 +122,7 @@ static void input_cb_last_event(struct input_event *evt)
122122
{
123123
memcpy(&last_event, evt, sizeof(last_event));
124124
}
125-
INPUT_LISTENER_CB_DEFINE(NULL, input_cb_last_event);
125+
INPUT_CALLBACK_DEFINE(NULL, input_cb_last_event);
126126

127127
ZTEST(input_api, test_report_apis)
128128
{

tests/subsys/input/input_longpress/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void test_cb(struct input_event *evt)
2828
memcpy(&last_events[1], &last_events[0], sizeof(struct input_event));
2929
memcpy(&last_events[0], evt, sizeof(struct input_event));
3030
}
31-
INPUT_LISTENER_CB_DEFINE(longpress_dev, test_cb);
31+
INPUT_CALLBACK_DEFINE(longpress_dev, test_cb);
3232

3333
ZTEST(longpress, test_longpress_test)
3434
{

0 commit comments

Comments
 (0)