Allows to have the 3.17 code closer to upstream
Signed-off-by: Benjamin Tissoires <[email protected]>
---
3.17/wacom.h | 6 ++++++
3.17/wacom_sys.c | 16 ++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/3.17/wacom.h b/3.17/wacom.h
index 0300a5a..5e37d79 100644
--- a/3.17/wacom.h
+++ b/3.17/wacom.h
@@ -120,6 +120,12 @@
#define WACOM_POWERSUPPLY_DESC(ps) (ps)
#endif
+#ifndef to_hid_device
+#define to_hid_device(pdev) \
+ container_of(pdev, struct hid_device, dev)
+#endif /* to_hid_device */
+
+
enum wacom_worker {
WACOM_WORKER_WIRELESS,
WACOM_WORKER_BATTERY,
diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c
index a24163f..6257a78 100644
--- a/3.17/wacom_sys.c
+++ b/3.17/wacom_sys.c
@@ -1050,7 +1050,7 @@ out:
static ssize_t wacom_led_select_store(struct device *dev, int set_id,
const char *buf, size_t count)
{
- struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct hid_device *hdev = to_hid_device(dev);
struct wacom *wacom = hid_get_drvdata(hdev);
unsigned int id;
int err;
@@ -1078,7 +1078,7 @@ static ssize_t wacom_led##SET_ID##_select_store(struct
device *dev, \
static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
- struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
+ struct hid_device *hdev = to_hid_device(dev);\
struct wacom *wacom = hid_get_drvdata(hdev); \
return scnprintf(buf, PAGE_SIZE, "%d\n", \
wacom->led.groups[SET_ID].select); \
@@ -1114,7 +1114,7 @@ static ssize_t wacom_luminance_store(struct wacom *wacom,
u8 *dest,
static ssize_t wacom_##name##_luminance_store(struct device *dev, \
struct device_attribute *attr, const char *buf, size_t count) \
{ \
- struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
+ struct hid_device *hdev = to_hid_device(dev);\
struct wacom *wacom = hid_get_drvdata(hdev); \
\
return wacom_luminance_store(wacom, &wacom->led.field, \
@@ -1137,7 +1137,7 @@ DEVICE_LUMINANCE_ATTR(buttons, img_lum);
static ssize_t wacom_button_image_store(struct device *dev, int button_id,
const char *buf, size_t count)
{
- struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct hid_device *hdev = to_hid_device(dev);
struct wacom *wacom = hid_get_drvdata(hdev);
int err;
unsigned len;
@@ -1602,7 +1602,7 @@ static ssize_t wacom_show_speed(struct device *dev,
struct device_attribute
*attr, char *buf)
{
- struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct hid_device *hdev = to_hid_device(dev);
struct wacom *wacom = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed);
@@ -1612,7 +1612,7 @@ static ssize_t wacom_store_speed(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct hid_device *hdev = to_hid_device(dev);
struct wacom *wacom = hid_get_drvdata(hdev);
u8 new_speed;
@@ -1636,7 +1636,7 @@ static ssize_t wacom_show_remote_mode(struct kobject
*kobj,
char *buf, int index)
{
struct device *dev = container_of(kobj->parent, struct device, kobj);
- struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct hid_device *hdev = to_hid_device(dev);
struct wacom *wacom = hid_get_drvdata(hdev);
u8 mode;
@@ -1720,7 +1720,7 @@ static ssize_t wacom_store_unpair_remote(struct kobject
*kobj,
{
unsigned char selector = 0;
struct device *dev = container_of(kobj->parent, struct device, kobj);
- struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct hid_device *hdev = to_hid_device(dev);
struct wacom *wacom = hid_get_drvdata(hdev);
int err;
--
2.14.3
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel