Return-Path: Date: Wed, 3 Feb 2010 15:50:29 +0100 (CET) From: Jiri Kosina To: Ping Cheng Cc: "Gunn, Brian" , Marcel Holtmann , linux-kernel@vger.kernel.org, BlueZ development Subject: Re: [PATCH 2/3] HID: Implement Wacom quirk in the kernel In-Reply-To: <167e8a331001290914t578ffef7y16d52e40c8c54079@mail.gmail.com> Message-ID: References: <167e8a331001290914t578ffef7y16d52e40c8c54079@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 List-ID: On Fri, 29 Jan 2010, Ping Cheng wrote: > + ? ? ? rep_data[0] = 0x03; rep_data[1] = 0x00; > + ? ? ? limit =3; > + ? ? ? do { > + ? ? ? ? ? ? ? ret = hdev->hid_output_raw_report(hdev, rep_data, 2, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? HID_FEATURE_REPORT); > + ? ? ? } while (ret < 0 && limit-- > 0); > > ? > hdev->hid_output_raw_report error is not a hard failure, i.e., the following four lines are unnecessay.?We can continue with the > rest of the code. > ? > + ? ? ? if (ret < 0) { > + ? ? ? ? ? ? ? dev_err(&hdev->dev, "failed to poke device #1, %d\n", ret); > + ? ? ? ? ? ? ? goto err_free; > + ? ? ? } > + > + ? ? ? /* 0x06 - high reporting speed, 0x05 - low speed */ > + ? ? ? rep_data[0] = 0x06; rep_data[1] = 0x00; > + ? ? ? limit = 3; > + ? ? ? do { > + ? ? ? ? ? ? ? ret = hdev->hid_output_raw_report(hdev, rep_data, 2, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? HID_FEATURE_REPORT); > + ? ? ? } while (ret < 0 && limit-- > 0); > > ? > Same comments apply here.?"/* Note that if query fails it is not a hard failure */" is?the comments?we use in the corresponding > Wacom USB driver, wacom_sys.c Thanks for the feedback. I have queued the patch below on top of all the other changes. From: Jiri Kosina Subject: [PATCH] HID: make Wacom modesetting failures non-fatal With Wacom tablet mode-setting moved from userspace into kernel, we don't have to consider failures of device queries through the _raw callback as hard failure, as the driver can safely continue anyway. This is consistent with the current USB driver in wacom_sys.c Reported-by: Ping Cheng Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index b8778db..8d3b46f 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -181,6 +181,11 @@ static int wacom_probe(struct hid_device *hdev, goto err_free; } + /* + * Note that if the raw queries fail, it's not a hard failure and it + * is safe to continue + */ + /* Set Wacom mode2 */ rep_data[0] = 0x03; rep_data[1] = 0x00; limit = 3; @@ -188,10 +193,8 @@ static int wacom_probe(struct hid_device *hdev, ret = hdev->hid_output_raw_report(hdev, rep_data, 2, HID_FEATURE_REPORT); } while (ret < 0 && limit-- > 0); - if (ret < 0) { - dev_err(&hdev->dev, "failed to poke device #1, %d\n", ret); - goto err_free; - } + if (ret < 0) + dev_warn(&hdev->dev, "failed to poke device #1, %d\n", ret); /* 0x06 - high reporting speed, 0x05 - low speed */ rep_data[0] = 0x06; rep_data[1] = 0x00; @@ -200,10 +203,8 @@ static int wacom_probe(struct hid_device *hdev, ret = hdev->hid_output_raw_report(hdev, rep_data, 2, HID_FEATURE_REPORT); } while (ret < 0 && limit-- > 0); - if (ret < 0) { - dev_err(&hdev->dev, "failed to poke device #2, %d\n", ret); - goto err_free; - } + if (ret < 0) + dev_warn(&hdev->dev, "failed to poke device #2, %d\n", ret); hidinput = list_entry(hdev->inputs.next, struct hid_input, list); input = hidinput->input; -- 1.6.4.2