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

iio: hid-sensor-magn-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
a67c385a 5b812ea5

+11 -5
+11 -5
drivers/iio/magnetometer/hid-sensor-magn-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 Magnetometer-3D: 0x200083*/ 35 - #define DRIVER_NAME "HID-SENSOR-200083" 36 - 37 33 enum magn_3d_channel { 38 34 CHANNEL_SCAN_INDEX_X, 39 35 CHANNEL_SCAN_INDEX_Y, ··· 386 390 return 0; 387 391 } 388 392 393 + static struct platform_device_id hid_magn_3d_ids[] = { 394 + { 395 + /* Format: HID-SENSOR-usage_id_in_hex_lowercase */ 396 + .name = "HID-SENSOR-200083", 397 + }, 398 + { /* sentinel */ } 399 + }; 400 + MODULE_DEVICE_TABLE(platform, hid_magn_3d_ids); 401 + 389 402 static struct platform_driver hid_magn_3d_platform_driver = { 403 + .id_table = hid_magn_3d_ids, 390 404 .driver = { 391 - .name = DRIVER_NAME, 405 + .name = KBUILD_MODNAME, 392 406 .owner = THIS_MODULE, 393 407 }, 394 408 .probe = hid_magn_3d_probe,