From patchwork Wed Dec 16 22:44:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 7866511 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1B7CC9F32E for ; Wed, 16 Dec 2015 22:44:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3928E203A5 for ; Wed, 16 Dec 2015 22:44:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64009201BB for ; Wed, 16 Dec 2015 22:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754702AbbLPWoM (ORCPT ); Wed, 16 Dec 2015 17:44:12 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35931 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753952AbbLPWoL (ORCPT ); Wed, 16 Dec 2015 17:44:11 -0500 Received: by mail-pa0-f43.google.com with SMTP id q3so10728424pav.3; Wed, 16 Dec 2015 14:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=Ar68+jsHyd6BKLg4sh15rIua2vfesChlZ4M/bO4FgqM=; b=fErPDg1IIGhMgX9lvJ098f6bTnj4LFogfL5nYjJ8ZyO/CFgMh6P6/xRSeRl+2A0EPW pl8qkHir2Fei/HFb/od/00qR5gDZYvxz19jr8/jhrSQgFKCNCvkkvOGeH1nzZmIFaQ/M BMqfZL4ttWgqaL+j6eslpyBPMAnSHkJPY06CH/cccMXNrVnO8gutYtP6RZUSLYq+Tq/G M/5l6vsVI4rpQfdF3BBdbJusEP7T0Fth7suK8HEmchWovX9M9hk7GniTBuAYs1LSvHd3 crmyPqQnOZ2BSbPIeY5mly7/r9LHW+7ivQtOLJQ+rtU7aFMngmqEy1GmbNKP8dXbVCFe ks9w== X-Received: by 10.66.120.200 with SMTP id le8mr67467384pab.61.1450305850741; Wed, 16 Dec 2015 14:44:10 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1301:5d51:b73b:83b4:3bd5]) by smtp.gmail.com with ESMTPSA id f2sm6951363pfj.30.2015.12.16.14.44.09 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 16 Dec 2015 14:44:09 -0800 (PST) Date: Wed, 16 Dec 2015 14:44:08 -0800 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Pavel Rojtberg , "Pierre-Loup A. Griffais" , Clement Calmels , linux-kernel@vger.kernel.org Subject: [PATCH] Input: xpad - use LED API when identifying wireless controllers Message-ID: <20151216224408.GA14261@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When lighting up the segment identifying wireless controller, Instead of sending command directly to the controller, let's do it via LED API (usinf led_set_brightness) so that LED object state is in sync with controller state and we'll light up the correct segment on resume as well. Signed-off-by: Dmitry Torokhov --- I do not have the hardware so please try this out. drivers/input/joystick/xpad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 36328b3..00a766b 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1118,7 +1118,7 @@ static void xpad_send_led_command(struct usb_xpad *xpad, int command) */ static void xpad_identify_controller(struct usb_xpad *xpad) { - xpad_send_led_command(xpad, (xpad->pad_nr % 4) + 2); + led_set_brightness(&xpad->led->led_cdev, (xpad->pad_nr % 4) + 2); } static void xpad_led_set(struct led_classdev *led_cdev,