Re: [Linuxwacom-devel] [PATCH] 2.6.32 RHEL: Add out of tree support for RHEL 6.10

2019-01-02 Thread Jason Gerecke
Looks good, but I have a few requests:

On Wed, Dec 12, 2018 at 5:05 PM Ping Cheng  wrote:
>
> Make those devices not supported by RHEL 6.10 into wacom-ot.ko so
> both drivers can live happily together ;).
>
> Signed-off-by: Ping Cheng 
> ---
>  2.6.32/Makefile.in | 17 -
>  2.6.32/wacom_sys.c |  7 ++-
>  2.6.32/wacom_wac.c | 18 ++
>  configure.ac   | 12 
>  4 files changed, 44 insertions(+), 10 deletions(-)
>
> diff --git a/2.6.32/Makefile.in b/2.6.32/Makefile.in
> index 6290771..4a331d6 100644
> --- a/2.6.32/Makefile.in
> +++ b/2.6.32/Makefile.in
> @@ -4,11 +4,19 @@ ifneq ($(KERNELRELEASE),)
>  # Do NOT indent stuff in this part! It has to be like this to make the
>  # $(error ... ) stuff work
>
> +RHEL6_RELEASE := @RHEL6_RELEASE@
> +WCM_OT_NAME := ""
> +
>  ifneq ($(CONFIG_USB_WACOM),y)
>  WCM_VERSION := $(shell cd $(KBUILD_EXTMOD)/.. && ./git-version-gen)
> -ccflags-y := -DWACOM_VERSION_SUFFIX=\"-$(WCM_VERSION)\" -Wall -Wextra 
> -Wno-unused-parameter -Wno-missing-field-initializers $(EXTRA_CFLAGS)
> -wacom-objs := wacom_wac.o wacom_sys.o
> -obj-m += wacom.o
> +   ifeq ($(RHEL6_RELEASE),10)
> +   WCM_OT_NAME := -ot
> +   ccflags-y := -DWACOM_VERSION_SUFFIX=\"-$(WCM_VERSION)\" -Wall -Wextra 
> -Wno-unused-parameter -Wno-missing-field-initializers $(EXTRA_CFLAGS) 
> -DRHEL6_RELEASE
> +   else
> +   ccflags-y := -DWACOM_VERSION_SUFFIX=\"-$(WCM_VERSION)\" -Wall -Wextra 
> -Wno-unused-parameter -Wno-missing-field-initializers $(EXTRA_CFLAGS)
> +   endif # RHEL6_RELEASE

To keep things cleaner, I'd leave the definition of "ccflags-y" alone
but add `ccflags-y += -DRHEL6_RELEASE` to the "ifeq" block.

> +wacom$(WCM_OT_NAME)-objs := wacom_wac.o wacom_sys.o
> +obj-m += wacom$(WCM_OT_NAME).o
>  obj-m += wacom_w8001.o
>  else
>  $(error You requested to build wacom with configure, but wacom is configured 
> as built-in in your kernel config)
> @@ -48,8 +56,7 @@ uninstall:
> @# which causes trouble for tools like 'rm' which don't
> @# see the path how you might think. As a workaround,
> @# first cd into the directory and then remove.
> -   cd $(WCM_KERNEL_DIR)/../extra; rm wacom.ko*
> -   cd $(WCM_KERNEL_DIR)/../extra; rm wacom_w8001.ko*
> +   cd $(WCM_KERNEL_DIR)/../extra; rm wacom*.ko*
> rm -f /etc/depmod.d/input-wacom.conf
> PATH="$(PATH):/bin:/sbin" depmod -a $(MODUTS)
>
> diff --git a/2.6.32/wacom_sys.c b/2.6.32/wacom_sys.c
> index 5ca4c61..4a1fb70 100644
> --- a/2.6.32/wacom_sys.c
> +++ b/2.6.32/wacom_sys.c
> @@ -39,6 +39,11 @@
>  #define HID_COLLECTION_END 0xc0
>  #define HID_LONGITEM   0xfc
>
> +#ifdef RHEL6_RELEASE
> +#define wacom_driver_name "wacom-ot"
> +#else
> +#define wacom_driver_name "wacom"
> +#endif
>
>  enum {
> WCM_UNDEFINED = 0,
> @@ -1088,7 +1093,7 @@ static int wacom_reset_resume(struct usb_interface 
> *intf)
>  }
>
>  static struct usb_driver wacom_driver = {
> -   .name = "wacom",
> +   .name = wacom_driver_name,
> .id_table = wacom_ids,
> .probe =wacom_probe,
> .disconnect =   wacom_disconnect,
> diff --git a/2.6.32/wacom_wac.c b/2.6.32/wacom_wac.c
> index c4705f8..9a5fe39 100644
> --- a/2.6.32/wacom_wac.c
> +++ b/2.6.32/wacom_wac.c
> @@ -2484,6 +2484,7 @@ void wacom_setup_input_capabilities(struct input_dev 
> *input_dev,
> wacom_setup_numbered_buttons(input_dev, numbered_buttons);
>  }
>
> +#ifndef RHEL6_RELEASE
>  static const struct wacom_features wacom_features_0x00 =
> { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN,5040, 3780, 255, 0,
>   PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
> @@ -2950,10 +2951,10 @@ static const struct wacom_features 
> wacom_features_0x343 =
>   WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
>  static const struct wacom_features wacom_features_0x34A =
> { "Wacom MobileStudio Pro 13 Touch", WACOM_PKGLEN_MSPROT, .type = 
> WACOM_MSPROT, /* Touch */
> - .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34D };
> + .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34D, .touch_max = 10 };

All of these touch_max modifications should go into their own patch.

>  static const struct wacom_features wacom_features_0x34B =
> { "Wacom MobileStudio Pro 16 Touch", WACOM_PKGLEN_MSPROT, .type = 
> WACOM_MSPROT, /* Touch */
> - .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34E };
> + .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34E, .touch_max = 10 };
>  static const struct wacom_features wacom_features_0x34D =
> { "Wacom MobileStudio Pro 13", WACOM_PKGLEN_MSPRO, 59552, 33848, 
> 8191, 63,
>   WACOM_MSPRO, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 11,
> @@ -2966,6 +2967,7 @@ static const struct wacom_features wacom_features_0x34E 
> =
>   WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
>   WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
>   .oVid = USB_VENDOR_ID_WACOM, .oPid 

[Linuxwacom-devel] [PATCH] 2.6.32 RHEL: Add out of tree support for RHEL 6.10

2018-12-12 Thread Ping Cheng
Make those devices not supported by RHEL 6.10 into wacom-ot.ko so
both drivers can live happily together ;).

Signed-off-by: Ping Cheng 
---
 2.6.32/Makefile.in | 17 -
 2.6.32/wacom_sys.c |  7 ++-
 2.6.32/wacom_wac.c | 18 ++
 configure.ac   | 12 
 4 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/2.6.32/Makefile.in b/2.6.32/Makefile.in
index 6290771..4a331d6 100644
--- a/2.6.32/Makefile.in
+++ b/2.6.32/Makefile.in
@@ -4,11 +4,19 @@ ifneq ($(KERNELRELEASE),)
 # Do NOT indent stuff in this part! It has to be like this to make the
 # $(error ... ) stuff work
 
+RHEL6_RELEASE := @RHEL6_RELEASE@
+WCM_OT_NAME := ""
+
 ifneq ($(CONFIG_USB_WACOM),y)
 WCM_VERSION := $(shell cd $(KBUILD_EXTMOD)/.. && ./git-version-gen)
-ccflags-y := -DWACOM_VERSION_SUFFIX=\"-$(WCM_VERSION)\" -Wall -Wextra 
-Wno-unused-parameter -Wno-missing-field-initializers $(EXTRA_CFLAGS)
-wacom-objs := wacom_wac.o wacom_sys.o
-obj-m += wacom.o
+   ifeq ($(RHEL6_RELEASE),10)
+   WCM_OT_NAME := -ot
+   ccflags-y := -DWACOM_VERSION_SUFFIX=\"-$(WCM_VERSION)\" -Wall -Wextra 
-Wno-unused-parameter -Wno-missing-field-initializers $(EXTRA_CFLAGS) 
-DRHEL6_RELEASE
+   else
+   ccflags-y := -DWACOM_VERSION_SUFFIX=\"-$(WCM_VERSION)\" -Wall -Wextra 
-Wno-unused-parameter -Wno-missing-field-initializers $(EXTRA_CFLAGS)
+   endif # RHEL6_RELEASE
+wacom$(WCM_OT_NAME)-objs := wacom_wac.o wacom_sys.o
+obj-m += wacom$(WCM_OT_NAME).o
 obj-m += wacom_w8001.o
 else
 $(error You requested to build wacom with configure, but wacom is configured 
as built-in in your kernel config)
@@ -48,8 +56,7 @@ uninstall:
@# which causes trouble for tools like 'rm' which don't
@# see the path how you might think. As a workaround,
@# first cd into the directory and then remove.
-   cd $(WCM_KERNEL_DIR)/../extra; rm wacom.ko*
-   cd $(WCM_KERNEL_DIR)/../extra; rm wacom_w8001.ko*
+   cd $(WCM_KERNEL_DIR)/../extra; rm wacom*.ko*
rm -f /etc/depmod.d/input-wacom.conf
PATH="$(PATH):/bin:/sbin" depmod -a $(MODUTS)
 
diff --git a/2.6.32/wacom_sys.c b/2.6.32/wacom_sys.c
index 5ca4c61..4a1fb70 100644
--- a/2.6.32/wacom_sys.c
+++ b/2.6.32/wacom_sys.c
@@ -39,6 +39,11 @@
 #define HID_COLLECTION_END 0xc0
 #define HID_LONGITEM   0xfc
 
+#ifdef RHEL6_RELEASE
+#define wacom_driver_name "wacom-ot"
+#else
+#define wacom_driver_name "wacom"
+#endif
 
 enum {
WCM_UNDEFINED = 0,
@@ -1088,7 +1093,7 @@ static int wacom_reset_resume(struct usb_interface *intf)
 }
 
 static struct usb_driver wacom_driver = {
-   .name = "wacom",
+   .name = wacom_driver_name,
.id_table = wacom_ids,
.probe =wacom_probe,
.disconnect =   wacom_disconnect,
diff --git a/2.6.32/wacom_wac.c b/2.6.32/wacom_wac.c
index c4705f8..9a5fe39 100644
--- a/2.6.32/wacom_wac.c
+++ b/2.6.32/wacom_wac.c
@@ -2484,6 +2484,7 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
wacom_setup_numbered_buttons(input_dev, numbered_buttons);
 }
 
+#ifndef RHEL6_RELEASE
 static const struct wacom_features wacom_features_0x00 =
{ "Wacom Penpartner", WACOM_PKGLEN_PENPRTN,5040, 3780, 255, 0,
  PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
@@ -2950,10 +2951,10 @@ static const struct wacom_features wacom_features_0x343 
=
  WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
 static const struct wacom_features wacom_features_0x34A =
{ "Wacom MobileStudio Pro 13 Touch", WACOM_PKGLEN_MSPROT, .type = 
WACOM_MSPROT, /* Touch */
- .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34D };
+ .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34D, .touch_max = 10 };
 static const struct wacom_features wacom_features_0x34B =
{ "Wacom MobileStudio Pro 16 Touch", WACOM_PKGLEN_MSPROT, .type = 
WACOM_MSPROT, /* Touch */
- .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34E };
+ .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34E, .touch_max = 10 };
 static const struct wacom_features wacom_features_0x34D =
{ "Wacom MobileStudio Pro 13", WACOM_PKGLEN_MSPRO, 59552, 33848, 8191, 
63,
  WACOM_MSPRO, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 11,
@@ -2966,6 +2967,7 @@ static const struct wacom_features wacom_features_0x34E =
  WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
  WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
  .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x34B };
+#endif /* Wacom Out-of-tree check */
 static const struct wacom_features wacom_features_0x34F =
{ "Wacom Cintiq Pro 13 FHD", WACOM_PKGLEN_MSPRO, 59552, 33848, 8191, 63,
  WACOM_MSPRO, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0,
@@ -2992,10 +2994,10 @@ static const struct wacom_features wacom_features_0x352 
=
  .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x356 };
 static const struct wacom_features wacom_features_0x353 =
{ "Wacom Cintiq Pro 13FHD Touch",