linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jiri Kosina <jkosina@suse.cz>, Ping Cheng <pinglinux@gmail.com>,
	Jason Gerecke <killertofu@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: [PATCH v2 14/23] Input - wacom: install LED/OLED sysfs files in the HID device instead of USB
Date: Tue, 15 Jul 2014 14:45:37 -0400	[thread overview]
Message-ID: <1405449946-11515-15-git-send-email-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <1405449946-11515-1-git-send-email-benjamin.tissoires@redhat.com>

Removes one more dependency over USB, but requires some changes in
the user space to find the sysfs files correctly.

This patch breaks the user space. However, the number of program
accessing the LEDs is quite limited and we can easily patch them
to handle the new HID behavior.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
---

no changes in v2

 drivers/input/tablet/wacom_sys.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index ce76e1e..6e21064 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -675,7 +675,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 = dev_get_drvdata(dev);
+	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct wacom *wacom = hid_get_drvdata(hdev);
 	unsigned int id;
 	int err;
@@ -703,7 +703,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 = dev_get_drvdata(dev);			\
+	struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
 	struct wacom *wacom = hid_get_drvdata(hdev);			\
 	return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]);	\
 }									\
@@ -738,7 +738,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 = dev_get_drvdata(dev);			\
+	struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
 	struct wacom *wacom = hid_get_drvdata(hdev);			\
 									\
 	return wacom_luminance_store(wacom, &wacom->led.field,		\
@@ -754,7 +754,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 = dev_get_drvdata(dev);
+	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct wacom *wacom = hid_get_drvdata(hdev);
 	int err;
 
@@ -845,7 +845,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
 		wacom->led.llv = 10;
 		wacom->led.hlv = 20;
 		wacom->led.img_lum = 10;
-		error = sysfs_create_group(&wacom->intf->dev.kobj,
+		error = sysfs_create_group(&wacom->hdev->dev.kobj,
 					   &intuos4_led_attr_group);
 		break;
 
@@ -857,7 +857,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
 		wacom->led.hlv = 0;
 		wacom->led.img_lum = 0;
 
-		error = sysfs_create_group(&wacom->intf->dev.kobj,
+		error = sysfs_create_group(&wacom->hdev->dev.kobj,
 					   &cintiq_led_attr_group);
 		break;
 
@@ -874,7 +874,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
 			wacom->led.hlv = 0;
 			wacom->led.img_lum = 0;
 
-			error = sysfs_create_group(&wacom->intf->dev.kobj,
+			error = sysfs_create_group(&wacom->hdev->dev.kobj,
 						  &intuos5_led_attr_group);
 		} else
 			return 0;
@@ -885,7 +885,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
 	}
 
 	if (error) {
-		dev_err(&wacom->intf->dev,
+		hid_err(wacom->hdev,
 			"cannot create sysfs group err: %d\n", error);
 		return error;
 	}
@@ -900,13 +900,13 @@ static void wacom_destroy_leds(struct wacom *wacom)
 	case INTUOS4S:
 	case INTUOS4:
 	case INTUOS4L:
-		sysfs_remove_group(&wacom->intf->dev.kobj,
+		sysfs_remove_group(&wacom->hdev->dev.kobj,
 				   &intuos4_led_attr_group);
 		break;
 
 	case WACOM_24HD:
 	case WACOM_21UX2:
-		sysfs_remove_group(&wacom->intf->dev.kobj,
+		sysfs_remove_group(&wacom->hdev->dev.kobj,
 				   &cintiq_led_attr_group);
 		break;
 
@@ -917,7 +917,7 @@ static void wacom_destroy_leds(struct wacom *wacom)
 	case INTUOSPM:
 	case INTUOSPL:
 		if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN)
-			sysfs_remove_group(&wacom->intf->dev.kobj,
+			sysfs_remove_group(&wacom->hdev->dev.kobj,
 					   &intuos5_led_attr_group);
 		break;
 	}
-- 
2.0.0


  parent reply	other threads:[~2014-07-15 18:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15 18:45 [PATCH v2 00/23] Wacom queued patches Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 01/23] Revert "Input: wacom - testing result shows get_report is unnecessary." Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 02/23] Input - wacom: assign phys field from struct wacom into input_dev Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 03/23] Input - wacom: create a separate input device for pads Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 04/23] Input - wacom: split out the pad device for Intuos/Cintiq Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 05/23] Input - wacom: split out the pad device for Bamboos Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 06/23] Input - wacom: split out the pad device for DTUS Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 07/23] Input - wacom: split out the pad device for Graphire G4 and MO Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 08/23] Input - wacom: split out the pad device for the wireless receiver Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 09/23] Input - wacom: include and use linux/hid.h Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 10/23] Input - wacom: switch from an USB driver to a HID driver Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 11/23] Input - wacom: use hid communication instead of plain usb Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 12/23] Input - wacom: use HID core to actually fetch the report descriptor Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 13/23] Input - wacom: compute the HID report size to get the actual packet size Benjamin Tissoires
2014-07-15 18:45 ` Benjamin Tissoires [this message]
2014-07-15 18:45 ` [PATCH v2 15/23] Input - wacom: register the input devices on top of the HID one Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 16/23] Input - wacom: remove usb dependency for siblings devices Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 17/23] Input - wacom: register power device at the HID level Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 18/23] Input - wacom: use hid_info instead of plain dev_info Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 19/23] Input - wacom: use in-kernel HID parser Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 20/23] Input - wacom: use hidinput_calc_abs_res instead of duplicating its code Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 21/23] Input - wacom: remove field pktlen declaration in the list of devices Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 22/23] Input - wacom: keep wacom_ids ordered Benjamin Tissoires
2014-07-15 18:45 ` [PATCH v2 23/23] Input - wacom: Move the USB (now hid) Wacom driver in drivers/hid Benjamin Tissoires
2014-07-24 20:25   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405449946-11515-15-git-send-email-benjamin.tissoires@redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=killertofu@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pinglinux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).