Support kernel 3.17 and later

wacom.ko is switched from input/tablet to hid in version 3.17. Add
a new branch to support this change.

Signed-off-by: Ping Cheng <pingc@wacom.com>
HID: wacom - Add default permission defines for sysfs attributes

RW : ug=rw,o=r
WO : ug=w

And enabled reading relavent sysfs attributes.

Signed-off-by: Paul A. Tessier <phernost@gmail.com>
Signed-Off-by: Ping Cheng <pingc@wacom.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
HID: wacom - Clean up of sysfs

changed to scnprintf(buf, PAGE_SIZE, ... ) as suggested in sysfs.txt
for show functions

Signed-off-by: Paul A. Tessier <phernost@gmail.com>
Signed-Off-by: Ping Cheng <pingc@wacom.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
HID: wacom - remove report_id from wacom_get_report interface

It is assigned in buf[0] anyway.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
HID: wacom - enable LED support for Wireless Intuos5/Pro

And associate all LED/OLED to PAD device

Signed-off-by: Ping Cheng <pingc@wacom.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Backport: HID: wacom - Add default permission defines for sysfs attributes

HID: wacom - Add default permission defines for sysfs attributes

RW : ug=rw,o=r
WO : ug=w

And enabled reading relavent sysfs attributes.

Signed-off-by: Paul A. Tessier <phernost@gmail.com>
Signed-Off-by: Ping Cheng <pingc@wacom.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Backport: HID: wacom - Clean up of sysfs

changed to scnprintf(buf, PAGE_SIZE, ... ) as suggested in sysfs.txt
for show functions

Signed-off-by: Paul A. Tessier <phernost@gmail.com>
Signed-Off-by: Ping Cheng <pingc@wacom.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
 Backport: HID: wacom - enable LED support for Wireless Intuos5/Pro

For kernels older than 2.6.38, only updated existing LED code since
they do not support wireless (yet).

Signed-off-by: Ping Cheng <pingc@wacom.com>
Fix compile issues with 3.17 backports

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Fix compile issues with older drivers

* Add missing semicolon to 0x4004 definition (2.6.38)
* Remove duplicate device definition (2.6.30)
* Add missing closing brace (2.6.30)

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Change 3.17 branch dependency to CONFIG_HID_WACOM

Kernel 3.17 migrates the wacom.ko driver from the USB tree to the HID
tree and now uses the CONFIG_HID_WACOM flag.
Use backwards-compatible battery name only for first tablet

Attaching multiple wireless tablets to a system will cause a kernel
crash when both power supply nodes try to use the same name. The 3.17
kernel adds a unique suffix to the end of every device, but we can't
do that here if we want to be backwards compatible. Instead, we use the
suffix-less name only if it has not already been registered and use the
new behavior otherwise.

Fixes SF bug #248

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Fix potential crash on tablet disconnect

It is possible for an application to trigger a segfault by attempting
to make use of a sysfs command (through a stale fd) after the memory
for the driver data has been freed. To prevent this, we check to
ensure that 'dev_get_drvdata' returns a non-null value before using
it.

WIP: Is there potentially still a window of opportunity where the
driver has a non-null (but free'd) drvdata that we'd dereference?
Also, Is it safe to set the LEDs after they've been "destroyed" but
before the 'wacom' struct has been freed?

Fixes SF bug #255

Signed-off-by: Jason Gerecke <killertofu@gmail.com>

If an application continues to hold a reference to one of the sysfs
nodes while the device is being disconnected, its possible to trigger
a sega