drm/tests: hdmi: Fix memory leaks in drm_display_mode_from_cea_vic()
[drm/drm-misc.git] / drivers / input / vivaldi-fmap.c
blob978949eba9eb19479a56f254831df5ff3ce7aae8
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Helpers for ChromeOS Vivaldi keyboard function row mapping
5 * Copyright (C) 2022 Google, Inc
6 */
8 #include <linux/export.h>
9 #include <linux/input/vivaldi-fmap.h>
10 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/types.h>
14 /**
15 * vivaldi_function_row_physmap_show - Print vivaldi function row physmap attribute
16 * @data: The vivaldi function row map
17 * @buf: Buffer to print the function row phsymap to
19 ssize_t vivaldi_function_row_physmap_show(const struct vivaldi_data *data,
20 char *buf)
22 ssize_t size = 0;
23 int i;
24 const u32 *physmap = data->function_row_physmap;
26 if (!data->num_function_row_keys)
27 return 0;
29 for (i = 0; i < data->num_function_row_keys; i++)
30 size += sysfs_emit_at(buf, size,
31 "%s%02X", size ? " " : "", physmap[i]);
32 if (size)
33 size += sysfs_emit_at(buf, size, "\n");
35 return size;
37 EXPORT_SYMBOL_GPL(vivaldi_function_row_physmap_show);
39 MODULE_DESCRIPTION("Helpers for ChromeOS Vivaldi keyboard function row mapping");
40 MODULE_LICENSE("GPL");