2013-07-10 08:32:44

by Alexander Holler

[permalink] [raw]
Subject: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

Hello,

I'm not sure if it was by intention that none of the hid-sensor drivers
were loaded automatically. But I assume it was not by intention.

Therefor I've added a module alias to every hid-sensor driver by adding
a MODULE_DEVICE_TABLE.

This has another benefit: it makes it possible to use a normale driver name.

Therefor I've changed all driver names to KBUILD_MODNAME instead of
HID-SENSOR-2000xx as the later isn't very descriptive when starring at
kernel messages.

Regards,

Alexander Holler


2013-07-10 08:32:52

by Alexander Holler

[permalink] [raw]
Subject: [PATCH 1/4] iio: hid-sensor-accel-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 <[email protected]>
---
drivers/iio/accel/hid-sensor-accel-3d.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index bbcbd71..275c5d7 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-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 Accelerometer-3D: 0x200073*/
-#define DRIVER_NAME "HID-SENSOR-200073"
-
enum accel_3d_channel {
CHANNEL_SCAN_INDEX_X,
CHANNEL_SCAN_INDEX_Y,
@@ -389,9 +385,19 @@ static int hid_accel_3d_remove(struct platform_device *pdev)
return 0;
}

+static struct platform_device_id hid_accel_3d_ids[] = {
+ {
+ /* Format: HID-SENSOR-usage_id_in_hex_lowercase */
+ .name = "HID-SENSOR-200073",
+ },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, hid_accel_3d_ids);
+
static struct platform_driver hid_accel_3d_platform_driver = {
+ .id_table = hid_accel_3d_ids,
.driver = {
- .name = DRIVER_NAME,
+ .name = KBUILD_MODNAME,
.owner = THIS_MODULE,
},
.probe = hid_accel_3d_probe,
--
1.8.1.5

2013-07-10 08:32:59

by Alexander Holler

[permalink] [raw]
Subject: [PATCH 2/4] 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 <[email protected]>
---
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

2013-07-10 08:33:11

by Alexander Holler

[permalink] [raw]
Subject: [PATCH 4/4] 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 <[email protected]>
---
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index 99f4e49..e71127a 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-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 Magnetometer-3D: 0x200083*/
-#define DRIVER_NAME "HID-SENSOR-200083"
-
enum magn_3d_channel {
CHANNEL_SCAN_INDEX_X,
CHANNEL_SCAN_INDEX_Y,
@@ -390,9 +386,19 @@ static int hid_magn_3d_remove(struct platform_device *pdev)
return 0;
}

+static struct platform_device_id hid_magn_3d_ids[] = {
+ {
+ /* Format: HID-SENSOR-usage_id_in_hex_lowercase */
+ .name = "HID-SENSOR-200083",
+ },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, hid_magn_3d_ids);
+
static struct platform_driver hid_magn_3d_platform_driver = {
+ .id_table = hid_magn_3d_ids,
.driver = {
- .name = DRIVER_NAME,
+ .name = KBUILD_MODNAME,
.owner = THIS_MODULE,
},
.probe = hid_magn_3d_probe,
--
1.8.1.5

2013-07-10 08:33:06

by Alexander Holler

[permalink] [raw]
Subject: [PATCH 3/4] iio: hid-sensor-als: 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 <[email protected]>
---
drivers/iio/light/hid-sensor-als.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index cdc2cad..9adfef0 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.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 Ambiant-Light: 0x200041*/
-#define DRIVER_NAME "HID-SENSOR-200041"
-
#define CHANNEL_SCAN_INDEX_ILLUM 0

struct als_state {
@@ -355,9 +351,19 @@ static int hid_als_remove(struct platform_device *pdev)
return 0;
}

+static struct platform_device_id hid_als_ids[] = {
+ {
+ /* Format: HID-SENSOR-usage_id_in_hex_lowercase */
+ .name = "HID-SENSOR-200041",
+ },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, hid_als_ids);
+
static struct platform_driver hid_als_platform_driver = {
+ .id_table = hid_als_ids,
.driver = {
- .name = DRIVER_NAME,
+ .name = KBUILD_MODNAME,
.owner = THIS_MODULE,
},
.probe = hid_als_probe,
--
1.8.1.5

2013-07-10 15:21:25

by srinivas pandruvada

[permalink] [raw]
Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

Hi,

There was no intention to prevent auto loading. Did you get chance to
test these changes?

Thanks,
Srinivas

On 07/10/2013 01:31 AM, Alexander Holler wrote:
> Hello,
>
> I'm not sure if it was by intention that none of the hid-sensor drivers
> were loaded automatically. But I assume it was not by intention.
>
> Therefor I've added a module alias to every hid-sensor driver by adding
> a MODULE_DEVICE_TABLE.
>
> This has another benefit: it makes it possible to use a normale driver name.
>
> Therefor I've changed all driver names to KBUILD_MODNAME instead of
> HID-SENSOR-2000xx as the later isn't very descriptive when starring at
> kernel messages.
>
> Regards,
>
> Alexander Holler
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2013-07-10 15:59:23

by Alexander Holler

[permalink] [raw]
Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

Am 10.07.2013 17:27, schrieb Srinivas Pandruvada:
> Hi,
>
> There was no intention to prevent auto loading. Did you get chance to
> test these changes?

Sure, I always test patches before I send them out.

Ok, I haven't tested the changes with the iio HID drivers (I don't have
any commercial HID sensor hub, so I've just compile tested these patches
here, double reading them), but I've tested the similiar changes with a
patch for rtc-hid-sensor-time I've send out yesterday. (sorry, no link,
lkml.org seems dead, just search for "rtc-hid-sensor-time: add module
alias")

It works just fine. An example output is now

Jul 9 19:27:21 dockstar3 kernel: [ 5.124444] rtc_hid_sensor_time
HID-SENSOR-2000a0.0: milliseconds supported
Jul 9 19:27:21 dockstar3 kernel: [ 5.132864] rtc_hid_sensor_time
HID-SENSOR-2000a0.0: rtc core: setting system clock to 2013-07-09
17:26:51:328000 UTC (1373390811)
Jul 9 19:27:21 dockstar3 kernel: [ 5.146105] rtc_hid_sensor_time
HID-SENSOR-2000a0.0: rtc core: registered hid-sensor-time as rtc0

Before the output was e.g.

HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: rtc core: registered
hid-sensor-time as rtc0

instead of the above with the descriptive rtc_hid_sensor_time.

Automatic loading of modules works too and it works on ARM, Intel and
AMD as module or static linked. ;)

Regards,

Alexander Holler

2013-07-11 17:22:39

by srinivas pandruvada

[permalink] [raw]
Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload



On 07/10/2013 08:58 AM, Alexander Holler wrote:
> Am 10.07.2013 17:27, schrieb Srinivas Pandruvada:
>> Hi,
>>
>> There was no intention to prevent auto loading. Did you get chance to
>> test these changes?
>
> Sure, I always test patches before I send them out.
>
> Ok, I haven't tested the changes with the iio HID drivers (I don't
> have any commercial HID sensor hub, so I've just compile tested these
> patches here, double reading them), but I've tested the similiar
> changes with a patch for rtc-hid-sensor-time I've send out yesterday.
> (sorry, no link, lkml.org seems dead, just search for
> "rtc-hid-sensor-time: add module alias")
>
> It works just fine. An example output is now
>
> Jul 9 19:27:21 dockstar3 kernel: [ 5.124444] rtc_hid_sensor_time
> HID-SENSOR-2000a0.0: milliseconds supported
> Jul 9 19:27:21 dockstar3 kernel: [ 5.132864] rtc_hid_sensor_time
> HID-SENSOR-2000a0.0: rtc core: setting system clock to 2013-07-09
> 17:26:51:328000 UTC (1373390811)
> Jul 9 19:27:21 dockstar3 kernel: [ 5.146105] rtc_hid_sensor_time
> HID-SENSOR-2000a0.0: rtc core: registered hid-sensor-time as rtc0
>
> Before the output was e.g.
>
> HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: rtc core: registered
> hid-sensor-time as rtc0
>
> instead of the above with the descriptive rtc_hid_sensor_time.
<Agreed. This is better. >
> Automatic loading of modules works too and it works on ARM, Intel and
> AMD as module or static linked. ;)
>
> Regards,
>
> Alexander Holler
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2013-07-12 07:22:23

by Alexander Holler

[permalink] [raw]
Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

Am 11.07.2013 19:27, schrieb Srinivas Pandruvada:
>
>
> On 07/10/2013 08:58 AM, Alexander Holler wrote:
>> Am 10.07.2013 17:27, schrieb Srinivas Pandruvada:
>>> Hi,
>>>
>>> There was no intention to prevent auto loading. Did you get chance to
>>> test these changes?
>>
>> Sure, I always test patches before I send them out.
>>
>> Ok, I haven't tested the changes with the iio HID drivers (I don't
>> have any commercial HID sensor hub, so I've just compile tested these
>> patches here, double reading them), but I've tested the similiar
>> changes with a patch for rtc-hid-sensor-time I've send out yesterday.
>> (sorry, no link, lkml.org seems dead, just search for
>> "rtc-hid-sensor-time: add module alias")
>>
>> It works just fine. An example output is now
>>
>> Jul 9 19:27:21 dockstar3 kernel: [ 5.124444] rtc_hid_sensor_time
>> HID-SENSOR-2000a0.0: milliseconds supported
>> Jul 9 19:27:21 dockstar3 kernel: [ 5.132864] rtc_hid_sensor_time
>> HID-SENSOR-2000a0.0: rtc core: setting system clock to 2013-07-09
>> 17:26:51:328000 UTC (1373390811)
>> Jul 9 19:27:21 dockstar3 kernel: [ 5.146105] rtc_hid_sensor_time
>> HID-SENSOR-2000a0.0: rtc core: registered hid-sensor-time as rtc0
>>
>> Before the output was e.g.
>>
>> HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: rtc core: registered
>> hid-sensor-time as rtc0
>>
>> instead of the above with the descriptive rtc_hid_sensor_time.
> <Agreed. This is better. >
>> Automatic loading of modules works too and it works on ARM, Intel and
>> AMD as module or static linked. ;)

Do you have tested the patches with a real device? I assume you have one. ;)

Regards,

Alexander Holler

2013-07-12 18:44:48

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

On 07/12/2013 08:21 AM, Alexander Holler wrote:
> Am 11.07.2013 19:27, schrieb Srinivas Pandruvada:
>>
>>
>> On 07/10/2013 08:58 AM, Alexander Holler wrote:
>>> Am 10.07.2013 17:27, schrieb Srinivas Pandruvada:
>>>> Hi,
>>>>
>>>> There was no intention to prevent auto loading. Did you get chance to
>>>> test these changes?
>>>
>>> Sure, I always test patches before I send them out.
>>>
>>> Ok, I haven't tested the changes with the iio HID drivers (I don't
>>> have any commercial HID sensor hub, so I've just compile tested these
>>> patches here, double reading them), but I've tested the similiar
>>> changes with a patch for rtc-hid-sensor-time I've send out yesterday.
>>> (sorry, no link, lkml.org seems dead, just search for
>>> "rtc-hid-sensor-time: add module alias")
>>>
>>> It works just fine. An example output is now
>>>
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.124444] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: milliseconds supported
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.132864] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: rtc core: setting system clock to 2013-07-09
>>> 17:26:51:328000 UTC (1373390811)
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.146105] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: rtc core: registered hid-sensor-time as rtc0
>>>
>>> Before the output was e.g.
>>>
>>> HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: rtc core: registered
>>> hid-sensor-time as rtc0
>>>
>>> instead of the above with the descriptive rtc_hid_sensor_time.
>> <Agreed. This is better. >
>>> Automatic loading of modules works too and it works on ARM, Intel and
>>> AMD as module or static linked. ;)
>
> Do you have tested the patches with a real device? I assume you have one. ;)
>
> Regards,
>
> Alexander Holler

Just so you two know. Given this discussion, I'll be lazy about these and
wait for an Ack from Srinivas before taking these. Look fine to me, but
nice to have confirmation as you say with the actual hardware!

Jonathan

2013-07-12 18:50:40

by Pandruvada, Srinivas

[permalink] [raw]
Subject: RE: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

Looks fine, but will test on actual hardware in couple of days.

Thanks,
Srinivas

-----Original Message-----
From: Jonathan Cameron [mailto:[email protected]]
Sent: Friday, July 12, 2013 11:45 AM
To: Alexander Holler
Cc: Srinivas Pandruvada; [email protected]; [email protected]; Jonathan Cameron; Pandruvada, Srinivas
Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

On 07/12/2013 08:21 AM, Alexander Holler wrote:
> Am 11.07.2013 19:27, schrieb Srinivas Pandruvada:
>>
>>
>> On 07/10/2013 08:58 AM, Alexander Holler wrote:
>>> Am 10.07.2013 17:27, schrieb Srinivas Pandruvada:
>>>> Hi,
>>>>
>>>> There was no intention to prevent auto loading. Did you get chance
>>>> to test these changes?
>>>
>>> Sure, I always test patches before I send them out.
>>>
>>> Ok, I haven't tested the changes with the iio HID drivers (I don't
>>> have any commercial HID sensor hub, so I've just compile tested
>>> these patches here, double reading them), but I've tested the
>>> similiar changes with a patch for rtc-hid-sensor-time I've send out yesterday.
>>> (sorry, no link, lkml.org seems dead, just search for
>>> "rtc-hid-sensor-time: add module alias")
>>>
>>> It works just fine. An example output is now
>>>
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.124444] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: milliseconds supported
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.132864] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: rtc core: setting system clock to 2013-07-09
>>> 17:26:51:328000 UTC (1373390811)
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.146105] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: rtc core: registered hid-sensor-time as rtc0
>>>
>>> Before the output was e.g.
>>>
>>> HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: rtc core: registered
>>> hid-sensor-time as rtc0
>>>
>>> instead of the above with the descriptive rtc_hid_sensor_time.
>> <Agreed. This is better. >
>>> Automatic loading of modules works too and it works on ARM, Intel
>>> and AMD as module or static linked. ;)
>
> Do you have tested the patches with a real device? I assume you have
> one. ;)
>
> Regards,
>
> Alexander Holler

Just so you two know. Given this discussion, I'll be lazy about these and wait for an Ack from Srinivas before taking these. Look fine to me, but nice to have confirmation as you say with the actual hardware!

Jonathan

2013-07-12 21:42:56

by srinivas pandruvada

[permalink] [raw]
Subject: Re: [PATCH 2/4] iio: hid-sensor-gyro-3d: add module alias for autoload

Tested. You can add my ack.

Acked-by:Srinivas Pandruvada<[email protected]>


On 07/10/2013 01:31 AM, Alexander Holler wrote:
> 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 <[email protected]>
> ---
> 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,

2013-07-12 21:43:14

by srinivas pandruvada

[permalink] [raw]
Subject: Re: [PATCH 3/4] iio: hid-sensor-als: add module alias for autoload

Tested. You can add my ack.

Acked-by:Srinivas Pandruvada<[email protected]>


On 07/10/2013 01:31 AM, Alexander Holler wrote:
> 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 <[email protected]>
> ---
> drivers/iio/light/hid-sensor-als.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
> index cdc2cad..9adfef0 100644
> --- a/drivers/iio/light/hid-sensor-als.c
> +++ b/drivers/iio/light/hid-sensor-als.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 Ambiant-Light: 0x200041*/
> -#define DRIVER_NAME "HID-SENSOR-200041"
> -
> #define CHANNEL_SCAN_INDEX_ILLUM 0
>
> struct als_state {
> @@ -355,9 +351,19 @@ static int hid_als_remove(struct platform_device *pdev)
> return 0;
> }
>
> +static struct platform_device_id hid_als_ids[] = {
> + {
> + /* Format: HID-SENSOR-usage_id_in_hex_lowercase */
> + .name = "HID-SENSOR-200041",
> + },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(platform, hid_als_ids);
> +
> static struct platform_driver hid_als_platform_driver = {
> + .id_table = hid_als_ids,
> .driver = {
> - .name = DRIVER_NAME,
> + .name = KBUILD_MODNAME,
> .owner = THIS_MODULE,
> },
> .probe = hid_als_probe,

2013-07-12 21:43:30

by srinivas pandruvada

[permalink] [raw]
Subject: Re: [PATCH 4/4] iio: hid-sensor-magn-3d: add module alias for autoload

Tested. You can add my ack.

Acked-by:Srinivas Pandruvada<[email protected]>


On 07/10/2013 01:32 AM, Alexander Holler wrote:
> 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 <[email protected]>
> ---
> drivers/iio/magnetometer/hid-sensor-magn-3d.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> index 99f4e49..e71127a 100644
> --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> +++ b/drivers/iio/magnetometer/hid-sensor-magn-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 Magnetometer-3D: 0x200083*/
> -#define DRIVER_NAME "HID-SENSOR-200083"
> -
> enum magn_3d_channel {
> CHANNEL_SCAN_INDEX_X,
> CHANNEL_SCAN_INDEX_Y,
> @@ -390,9 +386,19 @@ static int hid_magn_3d_remove(struct platform_device *pdev)
> return 0;
> }
>
> +static struct platform_device_id hid_magn_3d_ids[] = {
> + {
> + /* Format: HID-SENSOR-usage_id_in_hex_lowercase */
> + .name = "HID-SENSOR-200083",
> + },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(platform, hid_magn_3d_ids);
> +
> static struct platform_driver hid_magn_3d_platform_driver = {
> + .id_table = hid_magn_3d_ids,
> .driver = {
> - .name = DRIVER_NAME,
> + .name = KBUILD_MODNAME,
> .owner = THIS_MODULE,
> },
> .probe = hid_magn_3d_probe,

2013-07-12 21:46:56

by Pandruvada, Srinivas

[permalink] [raw]
Subject: RE: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

Tested and ready to go.

Thanks,
Srinivas


-----Original Message-----
From: Jonathan Cameron [mailto:[email protected]]
Sent: Friday, July 12, 2013 11:45 AM
To: Alexander Holler
Cc: Srinivas Pandruvada; [email protected]; [email protected]; Jonathan Cameron; Pandruvada, Srinivas
Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

On 07/12/2013 08:21 AM, Alexander Holler wrote:
> Am 11.07.2013 19:27, schrieb Srinivas Pandruvada:
>>
>>
>> On 07/10/2013 08:58 AM, Alexander Holler wrote:
>>> Am 10.07.2013 17:27, schrieb Srinivas Pandruvada:
>>>> Hi,
>>>>
>>>> There was no intention to prevent auto loading. Did you get chance
>>>> to test these changes?
>>>
>>> Sure, I always test patches before I send them out.
>>>
>>> Ok, I haven't tested the changes with the iio HID drivers (I don't
>>> have any commercial HID sensor hub, so I've just compile tested
>>> these patches here, double reading them), but I've tested the
>>> similiar changes with a patch for rtc-hid-sensor-time I've send out yesterday.
>>> (sorry, no link, lkml.org seems dead, just search for
>>> "rtc-hid-sensor-time: add module alias")
>>>
>>> It works just fine. An example output is now
>>>
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.124444] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: milliseconds supported
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.132864] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: rtc core: setting system clock to 2013-07-09
>>> 17:26:51:328000 UTC (1373390811)
>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.146105] rtc_hid_sensor_time
>>> HID-SENSOR-2000a0.0: rtc core: registered hid-sensor-time as rtc0
>>>
>>> Before the output was e.g.
>>>
>>> HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: rtc core: registered
>>> hid-sensor-time as rtc0
>>>
>>> instead of the above with the descriptive rtc_hid_sensor_time.
>> <Agreed. This is better. >
>>> Automatic loading of modules works too and it works on ARM, Intel
>>> and AMD as module or static linked. ;)
>
> Do you have tested the patches with a real device? I assume you have
> one. ;)
>
> Regards,
>
> Alexander Holler

Just so you two know. Given this discussion, I'll be lazy about these and wait for an Ack from Srinivas before taking these. Look fine to me, but nice to have confirmation as you say with the actual hardware!

Jonathan

2013-07-13 13:30:00

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload

Thanks,

All 4 applied to the togreg branch of iio.git

Jonathan

On 07/12/2013 10:46 PM, Pandruvada, Srinivas wrote:
> Tested and ready to go.
>
> Thanks,
> Srinivas
>
>
> -----Original Message-----
> From: Jonathan Cameron [mailto:[email protected]]
> Sent: Friday, July 12, 2013 11:45 AM
> To: Alexander Holler
> Cc: Srinivas Pandruvada; [email protected]; [email protected]; Jonathan Cameron; Pandruvada, Srinivas
> Subject: Re: [PATCH 0/4] iio: hid-sensor: add module alias for autoload
>
> On 07/12/2013 08:21 AM, Alexander Holler wrote:
>> Am 11.07.2013 19:27, schrieb Srinivas Pandruvada:
>>>
>>>
>>> On 07/10/2013 08:58 AM, Alexander Holler wrote:
>>>> Am 10.07.2013 17:27, schrieb Srinivas Pandruvada:
>>>>> Hi,
>>>>>
>>>>> There was no intention to prevent auto loading. Did you get chance
>>>>> to test these changes?
>>>>
>>>> Sure, I always test patches before I send them out.
>>>>
>>>> Ok, I haven't tested the changes with the iio HID drivers (I don't
>>>> have any commercial HID sensor hub, so I've just compile tested
>>>> these patches here, double reading them), but I've tested the
>>>> similiar changes with a patch for rtc-hid-sensor-time I've send out yesterday.
>>>> (sorry, no link, lkml.org seems dead, just search for
>>>> "rtc-hid-sensor-time: add module alias")
>>>>
>>>> It works just fine. An example output is now
>>>>
>>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.124444] rtc_hid_sensor_time
>>>> HID-SENSOR-2000a0.0: milliseconds supported
>>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.132864] rtc_hid_sensor_time
>>>> HID-SENSOR-2000a0.0: rtc core: setting system clock to 2013-07-09
>>>> 17:26:51:328000 UTC (1373390811)
>>>> Jul 9 19:27:21 dockstar3 kernel: [ 5.146105] rtc_hid_sensor_time
>>>> HID-SENSOR-2000a0.0: rtc core: registered hid-sensor-time as rtc0
>>>>
>>>> Before the output was e.g.
>>>>
>>>> HID-SENSOR-2000a0 HID-SENSOR-2000a0.0: rtc core: registered
>>>> hid-sensor-time as rtc0
>>>>
>>>> instead of the above with the descriptive rtc_hid_sensor_time.
>>> <Agreed. This is better. >
>>>> Automatic loading of modules works too and it works on ARM, Intel
>>>> and AMD as module or static linked. ;)
>>
>> Do you have tested the patches with a real device? I assume you have
>> one. ;)
>>
>> Regards,
>>
>> Alexander Holler
>
> Just so you two know. Given this discussion, I'll be lazy about these and wait for an Ack from Srinivas before taking these. Look fine to me, but nice to have confirmation as you say with the actual hardware!
>
> Jonathan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>