linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] hid: fix hid-steelseries kconfig/build
       [not found] <20130501183734.7ad1efca2d06e75432edabbd@canb.auug.org.au>
@ 2013-05-01 18:44 ` Randy Dunlap
  2013-05-01 19:27   ` simon
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Randy Dunlap @ 2013-05-01 18:44 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next, linux-kernel, Jiri Kosina,
	linux-input@vger.kernel.org

From: Randy Dunlap <rdunlap@infradead.org>

Fix hid-steelseries build by making it depends on LEDS_CLASS.
Build errors happen when LEDS_CLASS=m  and HID_STEELSERIES=y.

drivers/built-in.o: In function `steelseries_srws1_remove':
hid-steelseries.c:(.text+0x3b97a1): undefined reference to `led_classdev_unregister'
drivers/built-in.o: In function `steelseries_srws1_probe':
hid-steelseries.c:(.text+0x3b9c51): undefined reference to `led_classdev_register'
hid-steelseries.c:(.text+0x3b9ce5): undefined reference to `led_classdev_register'
hid-steelseries.c:(.text+0x3b9d4b): undefined reference to `led_classdev_unregister'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
 drivers/hid/Kconfig |    1 +
 1 file changed, 1 insertion(+)

--- linux-next-20130501.orig/drivers/hid/Kconfig
+++ linux-next-20130501/drivers/hid/Kconfig
@@ -610,6 +610,7 @@ config HID_SPEEDLINK
 config HID_STEELSERIES
 	tristate "Steelseries SRW-S1 steering wheel support"
 	depends on HID
+	depends on LEDS_CLASS
 	---help---
 	Support for Steelseries SRW-S1 steering wheel
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -next] hid: fix hid-steelseries kconfig/build
  2013-05-01 18:44 ` [PATCH -next] hid: fix hid-steelseries kconfig/build Randy Dunlap
@ 2013-05-01 19:27   ` simon
  2013-05-01 19:39     ` Randy Dunlap
  2013-05-02  6:27   ` [PATCH] HID: hid-steelseries fix led class build issue Simon Wood
  2013-05-02  6:30   ` [PATCH] " Simon Wood
  2 siblings, 1 reply; 10+ messages in thread
From: simon @ 2013-05-01 19:27 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Stephen Rothwell, linux-next, linux-kernel, Jiri Kosina,
	linux-input@vger.kernel.org

Hi Randy and all,
Seems like you found a problem... but the relevant sections of
'hid-steelseries.c' already have
--
#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
...
#endif
--

Shouldn't this prevent the module having calls to register/unregister if
the LED_CLASS is not enabled?

Does forcing a 'depends on LED_CLASS' in Kconfig prevent the
hid-steelseries module being built on systems without LEDs, or is this
simply a way to ensure that the LED_CLASS module gets loaded first?

Simon.

> From: Randy Dunlap <rdunlap@infradead.org>
>
> Fix hid-steelseries build by making it depends on LEDS_CLASS.
> Build errors happen when LEDS_CLASS=m  and HID_STEELSERIES=y.
>
> drivers/built-in.o: In function `steelseries_srws1_remove':
> hid-steelseries.c:(.text+0x3b97a1): undefined reference to
> `led_classdev_unregister'
> drivers/built-in.o: In function `steelseries_srws1_probe':
> hid-steelseries.c:(.text+0x3b9c51): undefined reference to
> `led_classdev_register'
> hid-steelseries.c:(.text+0x3b9ce5): undefined reference to
> `led_classdev_register'
> hid-steelseries.c:(.text+0x3b9d4b): undefined reference to
> `led_classdev_unregister'
>
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> ---
>  drivers/hid/Kconfig |    1 +
>  1 file changed, 1 insertion(+)
>
> --- linux-next-20130501.orig/drivers/hid/Kconfig
> +++ linux-next-20130501/drivers/hid/Kconfig
> @@ -610,6 +610,7 @@ config HID_SPEEDLINK
>  config HID_STEELSERIES
>  	tristate "Steelseries SRW-S1 steering wheel support"
>  	depends on HID
> +	depends on LEDS_CLASS
>  	---help---
>  	Support for Steelseries SRW-S1 steering wheel
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -next] hid: fix hid-steelseries kconfig/build
  2013-05-01 19:27   ` simon
@ 2013-05-01 19:39     ` Randy Dunlap
  2013-05-01 20:32       ` simon
  0 siblings, 1 reply; 10+ messages in thread
From: Randy Dunlap @ 2013-05-01 19:39 UTC (permalink / raw)
  To: simon
  Cc: Stephen Rothwell, linux-next, linux-kernel, Jiri Kosina,
	linux-input@vger.kernel.org

On 05/01/13 12:27, simon@mungewell.org wrote:
> Hi Randy and all,
> Seems like you found a problem... but the relevant sections of
> 'hid-steelseries.c' already have
> --
> #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)

which should be replaced with:

#include <linux/kconfig.h>

#if IS_ENABLED(LEDS_CLASS)


> ...
> #endif
> --
> 
> Shouldn't this prevent the module having calls to register/unregister if
> the LED_CLASS is not enabled?

Please read the patch description.  CONFIG_LEDS_CLASS=m but CONFIG_HID_STEELSEREIS=y.
A builtin driver cannot make calls to a modular driver if the modular driver
is not loaded.  Is there a way to require that the modular driver is loaded
for hid-steelseries?  Maybe so, but I don't know.


> Does forcing a 'depends on LED_CLASS' in Kconfig prevent the
> hid-steelseries module being built on systems without LEDs, or is this
> simply a way to ensure that the LED_CLASS module gets loaded first?

It prevents the driver from being built.  I think that a satisfactory solution
would be this small change:

	depends on LEDS_CLASS || LEDS_CLASS=n

That makes HID_STEELSERIES depend on LEDS_CLASS when it is enabled but still
allows the driver to build when LEDS_CLASS=n.  Makes sense?



Oh, and please don't top-post.

Thanks.

> 
> Simon.
> 
>> From: Randy Dunlap <rdunlap@infradead.org>
>>
>> Fix hid-steelseries build by making it depends on LEDS_CLASS.
>> Build errors happen when LEDS_CLASS=m  and HID_STEELSERIES=y.
>>
>> drivers/built-in.o: In function `steelseries_srws1_remove':
>> hid-steelseries.c:(.text+0x3b97a1): undefined reference to
>> `led_classdev_unregister'
>> drivers/built-in.o: In function `steelseries_srws1_probe':
>> hid-steelseries.c:(.text+0x3b9c51): undefined reference to
>> `led_classdev_register'
>> hid-steelseries.c:(.text+0x3b9ce5): undefined reference to
>> `led_classdev_register'
>> hid-steelseries.c:(.text+0x3b9d4b): undefined reference to
>> `led_classdev_unregister'
>>
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> ---
>>  drivers/hid/Kconfig |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> --- linux-next-20130501.orig/drivers/hid/Kconfig
>> +++ linux-next-20130501/drivers/hid/Kconfig
>> @@ -610,6 +610,7 @@ config HID_SPEEDLINK
>>  config HID_STEELSERIES
>>  	tristate "Steelseries SRW-S1 steering wheel support"
>>  	depends on HID
>> +	depends on LEDS_CLASS
>>  	---help---
>>  	Support for Steelseries SRW-S1 steering wheel
>>
>> --


-- 
~Randy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -next] hid: fix hid-steelseries kconfig/build
  2013-05-01 19:39     ` Randy Dunlap
@ 2013-05-01 20:32       ` simon
  0 siblings, 0 replies; 10+ messages in thread
From: simon @ 2013-05-01 20:32 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: simon, Stephen Rothwell, linux-next, linux-kernel, Jiri Kosina,
	linux-input@vger.kernel.org

> On 05/01/13 12:27, simon@mungewell.org wrote:
>> Hi Randy and all,
>> Seems like you found a problem... but the relevant sections of
>> 'hid-steelseries.c' already have
>> --
>> #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
>
> which should be replaced with:
>
> #include <linux/kconfig.h>
>
> #if IS_ENABLED(LEDS_CLASS)
>
>
>> ...
>> #endif
>> --
>>
>> Shouldn't this prevent the module having calls to register/unregister if
>> the LED_CLASS is not enabled?
>
> Please read the patch description.  CONFIG_LEDS_CLASS=m but
> CONFIG_HID_STEELSEREIS=y.
> A builtin driver cannot make calls to a modular driver if the modular
> driver
> is not loaded.  Is there a way to require that the modular driver is
> loaded
> for hid-steelseries?  Maybe so, but I don't know.

I had a look around what other drivers do, but there is not much 'case
law' to follow (or copy from).

'drivers/media/radio/radio-shark.c' does it like this:
--
#if defined(CONFIG_LEDS_CLASS) || \
    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_RADIO_SHARK_MODULE))
...
#endif
--

Which I think is another solution, and perhaps a little more
readable/understandable (ie. you have led control if LED_CLASS is
built-in, or both the driver _and_ LED_CLASS are modules).


If there is not an objection to this style I'll prepare and test a patch
in the next couple of days.

Simon.

PS. 'drivers/platform/x86/fujitsu-laptop.c' might have the same issues as
hid-steelseries....

>
>
>> Does forcing a 'depends on LED_CLASS' in Kconfig prevent the
>> hid-steelseries module being built on systems without LEDs, or is this
>> simply a way to ensure that the LED_CLASS module gets loaded first?
>
> It prevents the driver from being built.  I think that a satisfactory
> solution
> would be this small change:
>
> 	depends on LEDS_CLASS || LEDS_CLASS=n
>
> That makes HID_STEELSERIES depend on LEDS_CLASS when it is enabled but
> still
> allows the driver to build when LEDS_CLASS=n.  Makes sense?
>
>
>
> Oh, and please don't top-post.
>
> Thanks.
>
>>
>> Simon.
>>
>>> From: Randy Dunlap <rdunlap@infradead.org>
>>>
>>> Fix hid-steelseries build by making it depends on LEDS_CLASS.
>>> Build errors happen when LEDS_CLASS=m  and HID_STEELSERIES=y.
>>>
>>> drivers/built-in.o: In function `steelseries_srws1_remove':
>>> hid-steelseries.c:(.text+0x3b97a1): undefined reference to
>>> `led_classdev_unregister'
>>> drivers/built-in.o: In function `steelseries_srws1_probe':
>>> hid-steelseries.c:(.text+0x3b9c51): undefined reference to
>>> `led_classdev_register'
>>> hid-steelseries.c:(.text+0x3b9ce5): undefined reference to
>>> `led_classdev_register'
>>> hid-steelseries.c:(.text+0x3b9d4b): undefined reference to
>>> `led_classdev_unregister'
>>>
>>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>>> ---
>>>  drivers/hid/Kconfig |    1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> --- linux-next-20130501.orig/drivers/hid/Kconfig
>>> +++ linux-next-20130501/drivers/hid/Kconfig
>>> @@ -610,6 +610,7 @@ config HID_SPEEDLINK
>>>  config HID_STEELSERIES
>>>  	tristate "Steelseries SRW-S1 steering wheel support"
>>>  	depends on HID
>>> +	depends on LEDS_CLASS
>>>  	---help---
>>>  	Support for Steelseries SRW-S1 steering wheel
>>>
>>> --
>
>
> --
> ~Randy
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] HID: hid-steelseries fix led class build issue
  2013-05-01 18:44 ` [PATCH -next] hid: fix hid-steelseries kconfig/build Randy Dunlap
  2013-05-01 19:27   ` simon
@ 2013-05-02  6:27   ` Simon Wood
  2013-05-02 21:50     ` Randy Dunlap
  2013-05-02  6:30   ` [PATCH] " Simon Wood
  2 siblings, 1 reply; 10+ messages in thread
From: Simon Wood @ 2013-05-02  6:27 UTC (permalink / raw)
  To: linux-input; +Cc: Jiri Kosina, linux-kernel, simon, Randy Dunlap

Fixes 'undefined reference' issue when hid-steelseries is built in,
but led-class is a module.
--
drivers/built-in.o: In function `steelseries_srws1_remove':
hid-steelseries.c:(.text+0x3b97a1): undefined reference to `led_classdev_unregister'
drivers/built-in.o: In function `steelseries_srws1_probe':
hid-steelseries.c:(.text+0x3b9c51): undefined reference to `led_classdev_register'
hid-steelseries.c:(.text+0x3b9ce5): undefined reference to `led_classdev_register'
hid-steelseries.c:(.text+0x3b9d4b): undefined reference to `led_classdev_unregister'
--

Patch allows LED control when led-class is built in, or both hid-steelseries
_and_ led-class are both modules.
---
 drivers/hid/hid-steelseries.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 2ed995c..dbd5e2e 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -19,7 +19,8 @@
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
 
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if defined(CONFIG_LEDS_CLASS) || \
+    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
 #define SRWS1_NUMBER_LEDS 15
 struct steelseries_srws1_data {
 	__u16 led_state;
@@ -108,7 +109,8 @@ static __u8 steelseries_srws1_rdesc_fixed[] = {
 0xC0                /*  End Collection                      */
 };
 
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if defined(CONFIG_LEDS_CLASS) || \
+    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
 static void steelseries_srws1_set_leds(struct hid_device *hdev, __u16 leds)
 {
 	struct list_head *report_list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
@@ -371,7 +373,8 @@ MODULE_DEVICE_TABLE(hid, steelseries_srws1_devices);
 static struct hid_driver steelseries_srws1_driver = {
 	.name = "steelseries_srws1",
 	.id_table = steelseries_srws1_devices,
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if defined(CONFIG_LEDS_CLASS) || \
+    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
 	.probe = steelseries_srws1_probe,
 	.remove = steelseries_srws1_remove,
 #endif
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] HID: hid-steelseries fix led class build issue
  2013-05-01 18:44 ` [PATCH -next] hid: fix hid-steelseries kconfig/build Randy Dunlap
  2013-05-01 19:27   ` simon
  2013-05-02  6:27   ` [PATCH] HID: hid-steelseries fix led class build issue Simon Wood
@ 2013-05-02  6:30   ` Simon Wood
  2 siblings, 0 replies; 10+ messages in thread
From: Simon Wood @ 2013-05-02  6:30 UTC (permalink / raw)
  To: linux-input; +Cc: Jiri Kosina, linux-kernel, simon, Randy Dunlap

Fixes 'undefined reference' issue when hid-steelseries is built in,
but led-class is a module.
--
drivers/built-in.o: In function `steelseries_srws1_remove':
hid-steelseries.c:(.text+0x3b97a1): undefined reference to `led_classdev_unregister'
drivers/built-in.o: In function `steelseries_srws1_probe':
hid-steelseries.c:(.text+0x3b9c51): undefined reference to `led_classdev_register'
hid-steelseries.c:(.text+0x3b9ce5): undefined reference to `led_classdev_register'
hid-steelseries.c:(.text+0x3b9d4b): undefined reference to `led_classdev_unregister'
--

Patch allows LED control when led-class is built in, or both hid-steelseries
_and_ led-class are both modules.

Signed-off-by: Simon Wood <simon@mungewell.org>
---
 drivers/hid/hid-steelseries.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 2ed995c..dbd5e2e 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -19,7 +19,8 @@
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
 
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if defined(CONFIG_LEDS_CLASS) || \
+    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
 #define SRWS1_NUMBER_LEDS 15
 struct steelseries_srws1_data {
 	__u16 led_state;
@@ -108,7 +109,8 @@ static __u8 steelseries_srws1_rdesc_fixed[] = {
 0xC0                /*  End Collection                      */
 };
 
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if defined(CONFIG_LEDS_CLASS) || \
+    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
 static void steelseries_srws1_set_leds(struct hid_device *hdev, __u16 leds)
 {
 	struct list_head *report_list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
@@ -371,7 +373,8 @@ MODULE_DEVICE_TABLE(hid, steelseries_srws1_devices);
 static struct hid_driver steelseries_srws1_driver = {
 	.name = "steelseries_srws1",
 	.id_table = steelseries_srws1_devices,
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if defined(CONFIG_LEDS_CLASS) || \
+    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
 	.probe = steelseries_srws1_probe,
 	.remove = steelseries_srws1_remove,
 #endif
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] HID: hid-steelseries fix led class build issue
  2013-05-02  6:27   ` [PATCH] HID: hid-steelseries fix led class build issue Simon Wood
@ 2013-05-02 21:50     ` Randy Dunlap
  2013-05-02 21:58       ` David Rientjes
  0 siblings, 1 reply; 10+ messages in thread
From: Randy Dunlap @ 2013-05-02 21:50 UTC (permalink / raw)
  To: Simon Wood; +Cc: linux-input, Jiri Kosina, linux-kernel

On 05/01/13 23:27, Simon Wood wrote:
> Fixes 'undefined reference' issue when hid-steelseries is built in,
> but led-class is a module.
> --
> drivers/built-in.o: In function `steelseries_srws1_remove':
> hid-steelseries.c:(.text+0x3b97a1): undefined reference to `led_classdev_unregister'
> drivers/built-in.o: In function `steelseries_srws1_probe':
> hid-steelseries.c:(.text+0x3b9c51): undefined reference to `led_classdev_register'
> hid-steelseries.c:(.text+0x3b9ce5): undefined reference to `led_classdev_register'
> hid-steelseries.c:(.text+0x3b9d4b): undefined reference to `led_classdev_unregister'
> --
> 
> Patch allows LED control when led-class is built in, or both hid-steelseries
> _and_ led-class are both modules.

OK, that builds.  Thanks.

Missing lines:  your Signed-off-by:
and
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>


> ---
>  drivers/hid/hid-steelseries.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
> index 2ed995c..dbd5e2e 100644
> --- a/drivers/hid/hid-steelseries.c
> +++ b/drivers/hid/hid-steelseries.c
> @@ -19,7 +19,8 @@
>  #include "usbhid/usbhid.h"
>  #include "hid-ids.h"
>  
> -#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
> +#if defined(CONFIG_LEDS_CLASS) || \
> +    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
>  #define SRWS1_NUMBER_LEDS 15
>  struct steelseries_srws1_data {
>  	__u16 led_state;
> @@ -108,7 +109,8 @@ static __u8 steelseries_srws1_rdesc_fixed[] = {
>  0xC0                /*  End Collection                      */
>  };
>  
> -#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
> +#if defined(CONFIG_LEDS_CLASS) || \
> +    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
>  static void steelseries_srws1_set_leds(struct hid_device *hdev, __u16 leds)
>  {
>  	struct list_head *report_list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
> @@ -371,7 +373,8 @@ MODULE_DEVICE_TABLE(hid, steelseries_srws1_devices);
>  static struct hid_driver steelseries_srws1_driver = {
>  	.name = "steelseries_srws1",
>  	.id_table = steelseries_srws1_devices,
> -#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
> +#if defined(CONFIG_LEDS_CLASS) || \
> +    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
>  	.probe = steelseries_srws1_probe,
>  	.remove = steelseries_srws1_remove,
>  #endif
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] HID: hid-steelseries fix led class build issue
  2013-05-02 21:50     ` Randy Dunlap
@ 2013-05-02 21:58       ` David Rientjes
  2013-05-03  1:43         ` [PATCH-V2] " Simon Wood
  0 siblings, 1 reply; 10+ messages in thread
From: David Rientjes @ 2013-05-02 21:58 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Simon Wood, linux-input, Jiri Kosina, linux-kernel

On Thu, 2 May 2013, Randy Dunlap wrote:

> > ---
> >  drivers/hid/hid-steelseries.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
> > index 2ed995c..dbd5e2e 100644
> > --- a/drivers/hid/hid-steelseries.c
> > +++ b/drivers/hid/hid-steelseries.c
> > @@ -19,7 +19,8 @@
> >  #include "usbhid/usbhid.h"
> >  #include "hid-ids.h"
> >  
> > -#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
> > +#if defined(CONFIG_LEDS_CLASS) || \
> > +    (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_HID_STEELSERIES_MODULE))
> >  #define SRWS1_NUMBER_LEDS 15
> >  struct steelseries_srws1_data {
> >  	__u16 led_state;

While we're working on getting a signed-off-by line, the clean way of 
handling this is

#if IS_BUILTIN(CONFIG_LEDS_CLASS) || \
    (IS_MODULE(CONFIG_LEDS_CLASS) && IS_MODULE(CONFIG_HID_STEELSERIES))

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH-V2] HID: hid-steelseries fix led class build issue
  2013-05-02 21:58       ` David Rientjes
@ 2013-05-03  1:43         ` Simon Wood
  2013-05-03  8:27           ` Jiri Kosina
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Wood @ 2013-05-03  1:43 UTC (permalink / raw)
  To: linux-input
  Cc: Jiri Kosina, linux-kernel, simon, Randy Dunlap, David Rientjes

Fixes 'undefined reference' issue when hid-steelseries is built in,
but led-class is a module.
--
drivers/built-in.o: In function `steelseries_srws1_remove':
hid-steelseries.c:(.text+0x3b97a1): undefined reference to `led_classdev_unregister'
drivers/built-in.o: In function `steelseries_srws1_probe':
hid-steelseries.c:(.text+0x3b9c51): undefined reference to `led_classdev_register'
hid-steelseries.c:(.text+0x3b9ce5): undefined reference to `led_classdev_register'
hid-steelseries.c:(.text+0x3b9d4b): undefined reference to `led_classdev_unregister'
--

Patch allows LED control when led-class is built in, or both hid-steelseries
_and_ led-class are both modules.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Simon Wood <simon@mungewell.org>
---
 drivers/hid/hid-steelseries.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 2ed995c..c7a7563 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -19,7 +19,8 @@
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
 
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if IS_BUILTIN(CONFIG_LEDS_CLASS) || \
+    (IS_MODULE(CONFIG_LEDS_CLASS) && IS_MODULE(CONFIG_HID_STEELSERIES))
 #define SRWS1_NUMBER_LEDS 15
 struct steelseries_srws1_data {
 	__u16 led_state;
@@ -108,7 +109,8 @@ static __u8 steelseries_srws1_rdesc_fixed[] = {
 0xC0                /*  End Collection                      */
 };
 
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if IS_BUILTIN(CONFIG_LEDS_CLASS) || \
+    (IS_MODULE(CONFIG_LEDS_CLASS) && IS_MODULE(CONFIG_HID_STEELSERIES))
 static void steelseries_srws1_set_leds(struct hid_device *hdev, __u16 leds)
 {
 	struct list_head *report_list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
@@ -371,7 +373,8 @@ MODULE_DEVICE_TABLE(hid, steelseries_srws1_devices);
 static struct hid_driver steelseries_srws1_driver = {
 	.name = "steelseries_srws1",
 	.id_table = steelseries_srws1_devices,
-#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#if IS_BUILTIN(CONFIG_LEDS_CLASS) || \
+    (IS_MODULE(CONFIG_LEDS_CLASS) && IS_MODULE(CONFIG_HID_STEELSERIES))
 	.probe = steelseries_srws1_probe,
 	.remove = steelseries_srws1_remove,
 #endif
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH-V2] HID: hid-steelseries fix led class build issue
  2013-05-03  1:43         ` [PATCH-V2] " Simon Wood
@ 2013-05-03  8:27           ` Jiri Kosina
  0 siblings, 0 replies; 10+ messages in thread
From: Jiri Kosina @ 2013-05-03  8:27 UTC (permalink / raw)
  To: Simon Wood; +Cc: linux-input, linux-kernel, Randy Dunlap, David Rientjes

On Thu, 2 May 2013, Simon Wood wrote:

> Fixes 'undefined reference' issue when hid-steelseries is built in,
> but led-class is a module.
> --
> drivers/built-in.o: In function `steelseries_srws1_remove':
> hid-steelseries.c:(.text+0x3b97a1): undefined reference to `led_classdev_unregister'
> drivers/built-in.o: In function `steelseries_srws1_probe':
> hid-steelseries.c:(.text+0x3b9c51): undefined reference to `led_classdev_register'
> hid-steelseries.c:(.text+0x3b9ce5): undefined reference to `led_classdev_register'
> hid-steelseries.c:(.text+0x3b9d4b): undefined reference to `led_classdev_unregister'
> --
> 
> Patch allows LED control when led-class is built in, or both hid-steelseries
> _and_ led-class are both modules.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Simon Wood <simon@mungewell.org>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-05-03  8:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20130501183734.7ad1efca2d06e75432edabbd@canb.auug.org.au>
2013-05-01 18:44 ` [PATCH -next] hid: fix hid-steelseries kconfig/build Randy Dunlap
2013-05-01 19:27   ` simon
2013-05-01 19:39     ` Randy Dunlap
2013-05-01 20:32       ` simon
2013-05-02  6:27   ` [PATCH] HID: hid-steelseries fix led class build issue Simon Wood
2013-05-02 21:50     ` Randy Dunlap
2013-05-02 21:58       ` David Rientjes
2013-05-03  1:43         ` [PATCH-V2] " Simon Wood
2013-05-03  8:27           ` Jiri Kosina
2013-05-02  6:30   ` [PATCH] " Simon Wood

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).