Skip to content

Commit a67c385

Browse files
ahollerjic23
authored andcommitted
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>
1 parent 5b812ea commit a67c385

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎drivers/iio/magnetometer/hid-sensor-magn-3d.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
#include <linux/iio/triggered_buffer.h>
3131
#include "../common/hid-sensors/hid-sensor-trigger.h"
3232

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-
3733
enum magn_3d_channel {
3834
CHANNEL_SCAN_INDEX_X,
3935
CHANNEL_SCAN_INDEX_Y,
@@ -390,9 +386,19 @@ static int hid_magn_3d_remove(struct platform_device *pdev)
390386
return 0;
391387
}
392388

389+
static struct platform_device_id hid_magn_3d_ids[] = {
390+
{
391+
/* Format: HID-SENSOR-usage_id_in_hex_lowercase */
392+
.name = "HID-SENSOR-200083",
393+
},
394+
{ /* sentinel */ }
395+
};
396+
MODULE_DEVICE_TABLE(platform, hid_magn_3d_ids);
397+
393398
static struct platform_driver hid_magn_3d_platform_driver = {
399+
.id_table = hid_magn_3d_ids,
394400
.driver = {
395-
.name = DRIVER_NAME,
401+
.name = KBUILD_MODNAME,
396402
.owner = THIS_MODULE,
397403
},
398404
.probe = hid_magn_3d_probe,

0 commit comments

Comments
 (0)