linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Holler <holler@ahsoftware.de>
To: linux-kernel@vger.kernel.org
Cc: linux-iio@vger.kernel.org, Jonathan Cameron <jic23@cam.ac.uk>,
	Srinivas Pandruvada <srinivas.pandruvada@intel.com>,
	Alexander Holler <holler@ahsoftware.de>
Subject: [PATCH 2/4] iio: hid-sensor-gyro-3d: add module alias for autoload
Date: Wed, 10 Jul 2013 10:31:58 +0200	[thread overview]
Message-ID: <1373445120-5407-3-git-send-email-holler@ahsoftware.de> (raw)
In-Reply-To: <1373445120-5407-1-git-send-email-holler@ahsoftware.de>

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>
---
 drivers/iio/gyro/hid-sensor-gyro-3d.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index bc943dd..9cc8aa1 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -30,10 +30,6 @@
 #include <linux/iio/triggered_buffer.h>
 #include "../common/hid-sensors/hid-sensor-trigger.h"
 
-/*Format: HID-SENSOR-usage_id_in_hex*/
-/*Usage ID from spec for Gyro-3D: 0x200076*/
-#define DRIVER_NAME "HID-SENSOR-200076"
-
 enum gyro_3d_channel {
 	CHANNEL_SCAN_INDEX_X,
 	CHANNEL_SCAN_INDEX_Y,
@@ -389,9 +385,19 @@ static int hid_gyro_3d_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct platform_device_id hid_gyro_3d_ids[] = {
+	{
+		/* Format: HID-SENSOR-usage_id_in_hex_lowercase */
+		.name = "HID-SENSOR-200076",
+	},
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, hid_gyro_3d_ids);
+
 static struct platform_driver hid_gyro_3d_platform_driver = {
+	.id_table = hid_gyro_3d_ids,
 	.driver = {
-		.name	= DRIVER_NAME,
+		.name	= KBUILD_MODNAME,
 		.owner	= THIS_MODULE,
 	},
 	.probe		= hid_gyro_3d_probe,
-- 
1.8.1.5


  parent reply	other threads:[~2013-07-10  8:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  8:31 [PATCH 0/4] iio: hid-sensor: add module alias for autoload Alexander Holler
2013-07-10  8:31 ` [PATCH 1/4] iio: hid-sensor-accel-3d: " Alexander Holler
2013-07-10  8:31 ` Alexander Holler [this message]
2013-07-12 21:49   ` [PATCH 2/4] iio: hid-sensor-gyro-3d: " Srinivas Pandruvada
2013-07-10  8:31 ` [PATCH 3/4] iio: hid-sensor-als: " Alexander Holler
2013-07-12 21:49   ` Srinivas Pandruvada
2013-07-10  8:32 ` [PATCH 4/4] iio: hid-sensor-magn-3d: " Alexander Holler
2013-07-12 21:49   ` Srinivas Pandruvada
2013-07-10 15:27 ` [PATCH 0/4] iio: hid-sensor: " Srinivas Pandruvada
2013-07-10 15:58   ` Alexander Holler
2013-07-11 17:27     ` Srinivas Pandruvada
2013-07-12  7:21       ` Alexander Holler
2013-07-12 18:44         ` Jonathan Cameron
2013-07-12 18:46           ` Pandruvada, Srinivas
2013-07-12 21:46           ` Pandruvada, Srinivas
2013-07-13 13:29             ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373445120-5407-3-git-send-email-holler@ahsoftware.de \
    --to=holler@ahsoftware.de \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.pandruvada@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).