lkml.org 
[lkml]   [2014]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 06/10] Input - wacom: prepare the driver to include BT devices
On Jul 25 2014 or thereabouts, Dmitry Torokhov wrote:
> Hi Benjamin,
>
> On Thu, Jul 24, 2014 at 02:14:01PM -0400, Benjamin Tissoires wrote:
> > Now that wacom is a hid driver, there is no point in having a separate
> > driver for bluetooth devices.
> > This patch prepares the common paths of Bluetooth devices in the
> > common wacom driver.
> > It also adds the sysfs file "speed" used by Bluetooth devices.
> >
> > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> > ---
> >
> > new in v2
> >
> > drivers/hid/wacom_sys.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++---
> > drivers/hid/wacom_wac.h | 2 ++
> > 2 files changed, 69 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> > index d0d06b8..add76ec 100644
> > --- a/drivers/hid/wacom_sys.c
> > +++ b/drivers/hid/wacom_sys.c
> > @@ -262,6 +262,12 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id,
> > return error < 0 ? error : 0;
> > }
> >
> > +static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed,
> > + struct wacom_features *features)
> > +{
> > + return 0;
> > +}
> > +
> > /*
> > * Switch the tablet into its most-capable mode. Wacom tablets are
> > * typically configured to power-up in a mode which sends mouse-like
> > @@ -272,6 +278,9 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id,
> > static int wacom_query_tablet_data(struct hid_device *hdev,
> > struct wacom_features *features)
> > {
> > + if (hdev->bus == BUS_BLUETOOTH)
> > + return wacom_bt_query_tablet_data(hdev, 1, features);
> > +
> > if (features->device_type == BTN_TOOL_FINGER) {
> > if (features->type > TABLETPC) {
> > /* MT Tablet PC touch */
> > @@ -890,6 +899,38 @@ static void wacom_destroy_battery(struct wacom *wacom)
> > }
> > }
> >
> > +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 wacom *wacom = hid_get_drvdata(hdev);
> > +
> > + return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed);
> > +}
> > +
> > +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 wacom *wacom = hid_get_drvdata(hdev);
> > + int new_speed;
> > +
> > + if (sscanf(buf, "%1d", &new_speed ) != 1)
>
> Checkpach is unhappy with ')' placement and I agree with it.
>

ouch

> > + return -EINVAL;
>
> kstrtou8?

re-ouch

>
> > +
> > + if (new_speed == 0 || new_speed == 1) {
> > + wacom_bt_query_tablet_data(hdev, new_speed,
> > + &wacom->wacom_wac.features);
> > + return strnlen(buf, PAGE_SIZE);
>
> This is weird. Normally you want to return count since you should refuse
> input with excessive data.

indeed

>
> > + } else
> > + return -EINVAL;
>
> Need braces on both branches.
>

Grmblmbl. I should not have blinded copied the code from one driver to
one other. I will send a v3 of the rest of the series on top of your
wacom branch, at some point next week. Other people can still try to
find out other mistakes meanwhile ;)

Thanks for the review.

Cheers,
Benjamin



\
 
 \ /
  Last update: 2014-07-26 06:01    [W:0.073 / U:1.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site