From patchwork Thu Nov 3 22:27:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Enrik Berkhan X-Patchwork-Id: 15229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp30315wru; Thu, 3 Nov 2022 15:32:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Q3qS28ePKEB05sTskcPmmFGXeHD/49nFSG7aUSk/rHvFgwZiEjrjNJXzOO1NBPZJexfRo X-Received: by 2002:a17:90b:d88:b0:211:4d8:1c93 with SMTP id bg8-20020a17090b0d8800b0021104d81c93mr50392737pjb.41.1667514737297; Thu, 03 Nov 2022 15:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667514737; cv=none; d=google.com; s=arc-20160816; b=gdCsl2hBKRgVyXieuslHpQU7vMyHXYcCyb0AjtCD4Iwho3rCHW+aaCaLJK0FljJx7P Yiz5O+SPRQV/WRZlklE3mibCdzJrEADMGL8ix4qIdGQ4eKVr13tAkZlUgDwn9JZo6Cij WXVKgUBS24rF9Hp0jZmVuzDY9XxoB+V6TDxIPUp3I/0nYEmNj0PX8PMZRTXuy/2r+bOk dAw05m8QoaftsKmp93yUE5I19wpAfqCh5EyuWJ+q/Jdy6xL2O0NlQMvqIL5pMg1KKzyx zQmUY+hJ84E2sVHp8l5FhyYGHDtP+156YhtGfd75sEtpZHkQbC8gk8+JMmEJ2vlkQJ6l 478Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2V9i7oQTNHUJPEiwVERmKoGE2858xzC1NoyImBvZTpE=; b=JrzQvorOkhYaNFjXSgBsgurl3nK2303gYqVMbNFEbTAZwcI95xFpziVlfYmzey6tyJ Ccpja1SCv1fQQZXuOPMUFqMdPQoykqJUlcL0tsV21TnkM7WEu1c/2KmyqhDPRQz0moYo EOBFUVIeDewCe4bbRQkYuxfwWxg8a9IvIah2Yy7XNT+xRZ2Al++gyFoiyRyabOFVZSUJ OLelA2hAwlb6dlJfbViAPh06FGWh1PA38Xh3aQ/5vTc7piHJzqqtGVkkQGcg2S5AAjzr 4mf6CROmHTHr+OYp1cPeR33QKIFHTqGjKWVASDEAlgBOxbyBq7v49yTHsO8vMvve6fTb vDZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a63f805000000b0043946964302si2277265pgh.173.2022.11.03.15.31.57; Thu, 03 Nov 2022 15:32:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231725AbiKCW1e (ORCPT + 99 others); Thu, 3 Nov 2022 18:27:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231349AbiKCW13 (ORCPT ); Thu, 3 Nov 2022 18:27:29 -0400 Received: from mail.inka.de (mail.inka.de [IPv6:2a04:c9c7:0:1073:217:a4ff:fe3b:e77c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BEFC21274; Thu, 3 Nov 2022 15:27:27 -0700 (PDT) Received: from mail3.berkhan-weisser.de ([2a03:4000:54:b9a::4]) by mail.inka.de with esmtpsa id 1oqigH-005aIe-ST; Thu, 03 Nov 2022 23:27:25 +0100 Received: from 127.0.0.1 (helo=localhost.localdomain) by mail3.berkhan-weisser.de with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1oqigH-005Ggn-FY; Thu, 03 Nov 2022 23:27:25 +0100 From: Enrik Berkhan To: linux-input@vger.kernel.org Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Rishi Gupta , Enrik Berkhan Subject: [PATCH v2 1/3] HID: mcp2221: don't connect hidraw Date: Thu, 3 Nov 2022 23:27:12 +0100 Message-Id: <20221103222714.21566-2-Enrik.Berkhan@inka.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221103222714.21566-1-Enrik.Berkhan@inka.de> References: <20220926202239.16379-1-Enrik.Berkhan@inka.de> <20221103222714.21566-1-Enrik.Berkhan@inka.de> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748515933482452555?= X-GMAIL-MSGID: =?utf-8?q?1748515933482452555?= The MCP2221 driver should not connect to the hidraw userspace interface, as it needs exclusive access to the chip. If you want to use /dev/hidrawX with the MCP2221, you need to avoid binding this driver to the device and use the hid generic driver instead (e.g. using udev rules). Signed-off-by: Enrik Berkhan Reported-by: Sven Zühlsdorf --- drivers/hid/hid-mcp2221.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c index 5886543b17f3..e61dd039354b 100644 --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -1110,12 +1110,19 @@ static int mcp2221_probe(struct hid_device *hdev, return ret; } - ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); + /* + * This driver uses the .raw_event callback and therefore does not need any + * HID_CONNECT_xxx flags. + */ + ret = hid_hw_start(hdev, 0); if (ret) { hid_err(hdev, "can't start hardware\n"); return ret; } + hid_info(hdev, "USB HID v%x.%02x Device [%s] on %s\n", hdev->version >> 8, + hdev->version & 0xff, hdev->name, hdev->phys); + ret = hid_hw_open(hdev); if (ret) { hid_err(hdev, "can't open device\n"); @@ -1145,8 +1152,7 @@ static int mcp2221_probe(struct hid_device *hdev, mcp->adapter.retries = 1; mcp->adapter.dev.parent = &hdev->dev; snprintf(mcp->adapter.name, sizeof(mcp->adapter.name), - "MCP2221 usb-i2c bridge on hidraw%d", - ((struct hidraw *)hdev->hidraw)->minor); + "MCP2221 usb-i2c bridge"); ret = devm_i2c_add_adapter(&hdev->dev, &mcp->adapter); if (ret) {