From patchwork Tue Mar 7 23:45:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roderick Colenbrander X-Patchwork-Id: 9609985 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 69D716046A for ; Tue, 7 Mar 2017 23:46:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A7E828535 for ; Tue, 7 Mar 2017 23:46:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EF1A2858C; Tue, 7 Mar 2017 23:46:51 +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_SIGNED, 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 F3BE528535 for ; Tue, 7 Mar 2017 23:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751334AbdCGXqt (ORCPT ); Tue, 7 Mar 2017 18:46:49 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:35816 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933287AbdCGXqo (ORCPT ); Tue, 7 Mar 2017 18:46:44 -0500 Received: by mail-pg0-f51.google.com with SMTP id b129so6022935pgc.2 for ; Tue, 07 Mar 2017 15:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaikai-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7o9MA+43vZEv9T/Cm9a0yeKdDI/XnE8YS6qGEq+Nf9g=; b=o1PpuXnhZ5EZYRjlY11moOCKwR+2pkV2pG8tySKN7lbyut+SGkVSApTGav7nwj/PHv g7sQmLAInFIxWcRof7h/VVRssEEGEyuRkqo6k2zdRSf6+x6T4kVNjUJeDZjouTexyRof lMXXmeQkrRWOTRUdmRhFGwgCy+B9bYGx2PHrLuX7AmjkItRfTb6nrBqBbWRNM2QKhsHq k9WBRnBAFg6wYLdUnsHxdcLprZStEEvTOH70hOiEdePtRPxAINcmzlD2WHYRpMOufw8y IucPB83bkBK43pw+EjE84gXXsLcf+NW6bXnLLruH2FyQNfsbAtoSPlgBxpoxLhrORdB3 ql2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7o9MA+43vZEv9T/Cm9a0yeKdDI/XnE8YS6qGEq+Nf9g=; b=XBg7BQVwzW3GwrsjtKtu57YckgEoKtvsredBFu+sPzRkhI6QpmP4X1PHIK+tmoaJDb 9wejm1NSXmrweqHTr5tQpbSiNl2y/pGEkXPY4xfcpuzTCM7FlNscnwRlPpNwk+MIDOsV i5AaybinX7wfjR3XlIsJIY6xWeUqsMJ7N247xiCwJOEm5j7KPKaxJohzsaSZeh6aLCnW iazcw0EBXAaCR3/Ko4p2O8T4416SPnbrSHZ0xKOG6rmhpueJH4vvXXOnyb6NVjaF2iia fMDAMCNDIXUEsPO0fCghTLgejNpGsY7ZvDyLFNPWcFk67P/EqRUiQSJKD1VJXGpJX5vz NxYw== X-Gm-Message-State: AMke39l/1JdEruwiirqOVoRryci6AagPEp1ZSGUSQ3xwNVpzxXoFZGkLGwhGJJO6fNc81SHV X-Received: by 10.98.6.133 with SMTP id 127mr3409479pfg.110.1488930326603; Tue, 07 Mar 2017 15:45:26 -0800 (PST) Received: from roderick.ad.gaikai.biz ([100.42.98.197]) by smtp.gmail.com with ESMTPSA id e7sm1890993pgp.2.2017.03.07.15.45.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Mar 2017 15:45:26 -0800 (PST) From: Roderick Colenbrander To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Jiri Kosina , Benjamin Tissoires , Simon Wood , Frank Praznik , Tim Bird , Roderick Colenbrander Subject: [PATCH 12/12] HID: sony: Perform duplicate device check earlier on Date: Tue, 7 Mar 2017 15:45:11 -0800 Message-Id: <20170307234511.30380-13-roderick@gaikai.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170307234511.30380-1-roderick@gaikai.com> References: <20170307234511.30380-1-roderick@gaikai.com> 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 From: Roderick Colenbrander Game controllers can be connected twice through USB and BT. Only one connection is allowed. Currently we perform a check for duplicate controllers halfway through device initialization. To prevent 'transient' devices, we should do this check as early as we can. Signed-off-by: Roderick Colenbrander --- drivers/hid/hid-sony.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index f8c4835..c92f590 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -2477,6 +2477,10 @@ static int sony_input_configured(struct hid_device *hdev, goto err_stop; } + ret = append_dev_id = sony_check_add(sc); + if (ret < 0) + goto err_stop; + ret = sony_allocate_output_report(sc); if (ret < 0) { hid_err(hdev, "failed to allocate the output report buffer\n"); @@ -2613,10 +2617,6 @@ static int sony_input_configured(struct hid_device *hdev, if (ret < 0) goto err_stop; - ret = append_dev_id = sony_check_add(sc); - if (ret < 0) - goto err_stop; - if (sc->quirks & SONY_LED_SUPPORT) { ret = sony_leds_init(sc); if (ret < 0)