Subject: Re: linux-next: build failure after merge of the hid tree

From: Jeremy Fitzhardinge <[email-masked]>
Date: Mon, 28 Nov 2011 17:30:59 -0800

On 11/28/2011 05:00 PM, Stephen Rothwell wrote:
> Hi Jiri,
>
> After merging the hid tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
>
> drivers/hid/hid-input.c: In function 'hidinput_hid_event':
> drivers/hid/hid-input.c:865:6: error: 'struct hid_device' has no member
named 'battery_val'
> drivers/hid/hid-input.c:866:3: error: 'struct hid_device' has no member
named 'battery_min'
> drivers/hid/hid-input.c:866:3: error: 'struct hid_device' has no member
named 'battery_max'
>
> Caused by commit 4f5ca836bef3 ("HID: hid-input: add support for HID
> devices reporting Battery Strength"). Those members are only defined when
> CONFIG_HID_BATTERY_STRENGTH is set.
>
> I have used the hid tree from next-20111128 for today.

Oh, sorry about that.  Is this sufficient?

Subject: [PATCH] hid-input: fix compile for !HID_BATTERY_STRENGTH

As reported by Stephen Rothwell:
drivers/hid/hid-input.c: In function 'hidinput_hid_event':
drivers/hid/hid-input.c:865:6: error: 'struct hid_device' has no member
named 'battery_val'
drivers/hid/hid-input.c:866:3: error: 'struct hid_device' has no member
named 'battery_min'
drivers/hid/hid-input.c:866:3: error: 'struct hid_device' has no member
named 'battery_max'

Signed-off-by: Jeremy Fitzhardinge <[email-masked]>
Reported-by: Stephen Rothwell <[email-masked]>

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 83afb86..d9cadb3 100644
- --- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -861,12 +861,14 @@ void hidinput_hid_event(struct hid_device *hid,
struct hid_field *field, struct
 
     input = field->hidinput->input;
 
+#ifdef CONFIG_HID_BATTERY_STRENGTH
     if (usage->hid == HID_DC_BATTERYSTRENGTH) {
         hid->battery_val = value;
         hid_dbg(hid, "battery value is %d (range %d-%d)\n",
             value, hid->battery_min, hid->battery_max);
         return;
     }
+#endif
 
     if (!usage->type)
         return;

    J