Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: hid-sensor-gyro-3d: add module alias for autoload

Add a MODULE_DEVICE_TABLE in order to let hotplug mechanisms automatically
load the driver.

This makes it also possible to use the usual driver name instead of
HID-SENSOR-2000xx which isn't very descriptive in kernel messages.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Acked-by:Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Alexander Holler and committed by
Jonathan Cameron
a411e735 66c721f7

+11 -5
+11 -5
drivers/iio/gyro/hid-sensor-gyro-3d.c
··· 30 30 #include <linux/iio/triggered_buffer.h> 31 31 #include "../common/hid-sensors/hid-sensor-trigger.h" 32 32 33 - /*Format: HID-SENSOR-usage_id_in_hex*/ 34 - /*Usage ID from spec for Gyro-3D: 0x200076*/ 35 - #define DRIVER_NAME "HID-SENSOR-200076" 36 - 37 33 enum gyro_3d_channel { 38 34 CHANNEL_SCAN_INDEX_X, 39 35 CHANNEL_SCAN_INDEX_Y, ··· 385 389 return 0; 386 390 } 387 391 392 + static struct platform_device_id hid_gyro_3d_ids[] = { 393 + { 394 + /* Format: HID-SENSOR-usage_id_in_hex_lowercase */ 395 + .name = "HID-SENSOR-200076", 396 + }, 397 + { /* sentinel */ } 398 + }; 399 + MODULE_DEVICE_TABLE(platform, hid_gyro_3d_ids); 400 + 388 401 static struct platform_driver hid_gyro_3d_platform_driver = { 402 + .id_table = hid_gyro_3d_ids, 389 403 .driver = { 390 - .name = DRIVER_NAME, 404 + .name = KBUILD_MODNAME, 391 405 .owner = THIS_MODULE, 392 406 }, 393 407 .probe = hid_gyro_3d_probe,