From patchwork Sun Jul 3 15:33:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9211247 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ADEB560572 for ; Sun, 3 Jul 2016 15:49:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C0912860A for ; Sun, 3 Jul 2016 15:49:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89FA328602; Sun, 3 Jul 2016 15:49:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F367285E8 for ; Sun, 3 Jul 2016 15:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752779AbcGCPtB (ORCPT ); Sun, 3 Jul 2016 11:49:01 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34030 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752639AbcGCPs6 (ORCPT ); Sun, 3 Jul 2016 11:48:58 -0400 Received: by mail-wm0-f66.google.com with SMTP id 187so16367470wmz.1 for ; Sun, 03 Jul 2016 08:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=SRED+pyj4YrrZV5KtyrdMHsQjseVaUFVQM0yK6NZBXg=; b=0UWuNb0isgTA44P+xA4RBac2oeKyG+DJhph7Tx2j9NCEPx1ueEMd8H9jheabCU15ia Sjhx0/yMJnpxrRCNXQJoBoGKx8+dl4ByBL+nhi4gT98Mci/QRE4QADQseTH4yL0nlP60 njhwnm79ldSdglMQsXlbrUdoTtGOfb9jQRDB/H6fGN87BcKzIudN8QFCvPySWpuRzHH2 xA1YFLCevuZp3bLoEaBSx3EhMLzZHr/t37YOMYhJgMZpkqx97xhGazxFI6qzRc9c9nEj YGPqK9rK9eFVB/8uXffhx8LsCW7Cj7O2cS1Vi8MXJWexSXpWmlY2jwleyfp1xcbJEPe0 2V+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=SRED+pyj4YrrZV5KtyrdMHsQjseVaUFVQM0yK6NZBXg=; b=CcisB2ltfhMWKbytZugXUihVHqOcY4hIZa/seq+xx02AkH93FR9E9IpESzOsueyDFn 3SvRPi4k7ODHuTN5MfpO5+S28/idihtMlGqzbh3gKqSb5IZflc8QEQytdcx4ovS4Z5ni mQSc0QQp/yf+jBjRK8AwNqiXwWgsqIuqTNR7d52WxshIJE07JsAQlV6ZNfTGuABnjBd2 JAcMADRe0gaMb0PqJ7CstM4lVUSLZ6DI5+43wECAQSUzQd+XEo+yYoRf/lAM1bw3TX/D eKKTYoXUKix5c+hHlbXoypl6XU2G5r6MT5Mpjb6zXtSVRZZKVUK900990XwmyaY9uPbl jafQ== X-Gm-Message-State: ALyK8tKuhmsnVano2uFYT/w3upUQxkV5b1K9NHtNfCzHhazxkvmPVK+NHcG0hJ6Kvg3k2Q== X-Received: by 10.194.101.233 with SMTP id fj9mr6664744wjb.54.1467560937299; Sun, 03 Jul 2016 08:48:57 -0700 (PDT) Received: from ?IPv6:2003:62:5f01:4400:b581:745a:44f6:55c2? (p200300625F014400B581745A44F655C2.dip0.t-ipconnect.de. [2003:62:5f01:4400:b581:745a:44f6:55c2]) by smtp.googlemail.com with ESMTPSA id p191sm8091810wme.7.2016.07.03.08.48.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jul 2016 08:48:56 -0700 (PDT) To: Benjamin Tissoires Cc: Jiri Kosina , linux-input@vger.kernel.org From: Heiner Kallweit Subject: [PATCH 1/2] HID: hid-led: remove report id from struct hidled_config Message-ID: <7f2bfc4f-ba5e-dacd-3c60-6bd0f7ac7237@gmail.com> Date: Sun, 3 Jul 2016 17:33:04 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Delcom uses the report id to submit command information. To be able to use the hidled framework also for Delcom devices we have to remove the report id from struct hidled_config. Signed-off-by: Heiner Kallweit --- drivers/hid/hid-led.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-led.c b/drivers/hid/hid-led.c index e11b645..fce2a03 100644 --- a/drivers/hid/hid-led.c +++ b/drivers/hid/hid-led.c @@ -54,7 +54,6 @@ struct hidled_config { int num_leds; size_t report_size; enum hidled_report_type report_type; - u8 report_id; int (*init)(struct hidled_device *ldev); int (*write)(struct led_classdev *cdev, enum led_brightness br); }; @@ -93,8 +92,6 @@ static int hidled_send(struct hidled_device *ldev, __u8 *buf) { int ret; - buf[0] = ldev->config->report_id; - mutex_lock(&ldev->lock); if (ldev->config->report_type == RAW_REQUEST) @@ -124,8 +121,6 @@ static int hidled_recv(struct hidled_device *ldev, __u8 *buf) if (ldev->config->report_type != RAW_REQUEST) return -EINVAL; - buf[0] = ldev->config->report_id; - mutex_lock(&ldev->lock); ret = hid_hw_raw_request(ldev->hdev, buf[0], buf, @@ -203,7 +198,7 @@ static int _thingm_write(struct led_classdev *cdev, enum led_brightness br, u8 offset) { struct hidled_led *led = to_hidled_led(cdev); - __u8 buf[MAX_REPORT_SIZE] = { [1] = 'c' }; + __u8 buf[MAX_REPORT_SIZE] = { 1, 'c' }; buf[2] = led->rgb->red.cdev.brightness; buf[3] = led->rgb->green.cdev.brightness; @@ -230,13 +225,12 @@ static const struct hidled_config hidled_config_thingm_v1 = { .num_leds = 1, .report_size = 9, .report_type = RAW_REQUEST, - .report_id = 1, .write = thingm_write_v1, }; static int thingm_init(struct hidled_device *ldev) { - __u8 buf[MAX_REPORT_SIZE] = { [1] = 'v' }; + __u8 buf[MAX_REPORT_SIZE] = { 1, 'v' }; int ret; ret = hidled_recv(ldev, buf); @@ -259,7 +253,6 @@ static const struct hidled_config hidled_configs[] = { .num_leds = 1, .report_size = 6, .report_type = OUTPUT_REPORT, - .report_id = 0, .write = riso_kagaku_write, }, { @@ -270,7 +263,6 @@ static const struct hidled_config hidled_configs[] = { .num_leds = 1, .report_size = 9, .report_type = RAW_REQUEST, - .report_id = 0, .init = dream_cheeky_init, .write = dream_cheeky_write, }, @@ -282,7 +274,6 @@ static const struct hidled_config hidled_configs[] = { .num_leds = 2, .report_size = 9, .report_type = RAW_REQUEST, - .report_id = 1, .init = thingm_init, .write = thingm_write, },