Received: by 2002:ac8:45c5:0:b0:405:464a:c27a with SMTP id e5csp1273329qto; Thu, 27 Jul 2023 09:31:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlHJ7ITFiYt0gT8L7hVKQ/MgHmtdy2LEPOuAolFvoHr1x5v7M9RCsGQm6q+XWQ/qJOIwfpQV X-Received: by 2002:a05:6a20:9389:b0:137:9622:17b7 with SMTP id x9-20020a056a20938900b00137962217b7mr6380591pzh.25.1690475473984; Thu, 27 Jul 2023 09:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690475473; cv=none; d=google.com; s=arc-20160816; b=goFh4JotQ3GcRWCu7cwSe4Tf2hFL4tq+AT3thGmzOmYedLIe49x6aiMHnnxwXjvWJO jRj9G75mpSMEr1ikilgtZcOZVaXtRiUowCUQ99bSyorsGYhwqw0Hcech7kgmUCHB6qnP WjluCVUe0z3jJ/JPteHXBFyTHj7EPcBltNEkCtoCZuZIVtoIkKFAA3Nqww8fFQzrljOK 3zFnUPUNXsiGWufKw+8voXxFE3wkDzE1aOWGQIhjZ//jHdXf2QpqdXMX0t6pDp7KBP7j Grg0ZoBXsE6efcd+dIyGgi3s2epPTTQ58O9UpvQSSHdHdndB56iDxRxMw6/yBZn04p48 2XKA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=icyg0XscLKxI4QWuQt/SdZeKJtNG1h8hw2HHWKc7NR4=; fh=2VnQlf1Gjf3Y7OKWNL2ImfE/XymE8DfNR42uI5I6F/U=; b=tbFW6lNWjMdaXM5b00v57NJDNkkDcya6cTJnMs9U+XiCfXETlrFQO328vGUiEmhrXP JKxEnK6/vp7447Uta9NMxJE5MOCfxnUwm0QJvW4rBubkvDLPLl7R7JCFIlkbnW46dAtS xszQC90r1Jz1j6nmne8HEzYTz36+aJw8ceN498Ydn+f9kbxlNWeXdflrVp/4YSKhmc9b 1MQHWsTMct6yQIZi/05yZQOgM+zkqFhMwclBdAp27NVv/byAAQJBKM0EKRO7+PL5b6oP LOQ57hLXvmIg1izIJP24eBjW8D/w+yfoNqIiV3OcaP5zB/kc3bpJ40x6D0A+VP4YRLwR V+Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@devtank-co-uk.20221208.gappssmtp.com header.s=20221208 header.b=F8eEU8TB; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a62-20020a639041000000b005639473079csi1434589pge.379.2023.07.27.09.30.57; Thu, 27 Jul 2023 09:31:13 -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; dkim=pass header.i=@devtank-co-uk.20221208.gappssmtp.com header.s=20221208 header.b=F8eEU8TB; 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 S233472AbjG0QXV (ORCPT + 99 others); Thu, 27 Jul 2023 12:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231838AbjG0QXU (ORCPT ); Thu, 27 Jul 2023 12:23:20 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A597198A for ; Thu, 27 Jul 2023 09:23:19 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-317744867a6so1185452f8f.1 for ; Thu, 27 Jul 2023 09:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devtank-co-uk.20221208.gappssmtp.com; s=20221208; t=1690474997; x=1691079797; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=icyg0XscLKxI4QWuQt/SdZeKJtNG1h8hw2HHWKc7NR4=; b=F8eEU8TBgKD8Nht48axdQI0b0VmKbMKvLLtB3Q86QwwDeoIeAy5DPjO/LTRYWTS7R5 TwQneady8od5YDlwDvKOUpayRaaS911NEbhJpalQqK8T6E2Jd1WkVk5epd76U9HmvZxl X0Jzqx9nYeDcB4vEdv4sbHpZMIjYomDSwcnQQTSb7CgBH6ejTOZz0MVSqJmtXTECBaV0 tLCQPztSlUdfjuL39jsmrapAhIFXSVcOLfPohJ8QPWBHUWEmo9FUkjq0OT7lj1e//ezs Kuk+sGEchy8QR4JErJZEvlN6pXNjrWYtkL6TuaSahioBbI7+FfiKFbDhGcv9RvA4oNmK cTdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690474997; x=1691079797; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=icyg0XscLKxI4QWuQt/SdZeKJtNG1h8hw2HHWKc7NR4=; b=WIcitOZsV6etLxBWcJBhC/QFafbOCAKyAzf4Jzi3OdVxnGg2TYn1t/eVRwIVGC0/Qb 27xo0n/89s9IoG4CK2fQjOScf0KN+OqU7eAWecHwEhMIsDypgB72KuFjuyBFb6GDoPN+ YzxcH0oc/Tcq8r9kBEj08vseECRgkeE5YC87o8FvS6j744+f52DiCq97kFZnkWGR1LD9 73sV3VEzcZxn79ij8WxY0Dn5BjolG4TyBj/f1FW7zuPSSFrPE9w8YOw0HjwFD83ToHf9 4vp/DfK3kO6IznpszgAvTy97SpPoPASFesy3/zLGcSH6jootpAt8a0M+5zq7y1jxuHun MjuQ== X-Gm-Message-State: ABy/qLaZMGlY8RjSKGzOkNcYO3wG6b3eebEU3pYQUKI3Cru39y36VfNl KBQvuGFexTkfr4mo9h+XXeyXQA== X-Received: by 2002:adf:db46:0:b0:30e:5bd0:21a2 with SMTP id f6-20020adfdb46000000b0030e5bd021a2mr2030931wrj.52.1690474997374; Thu, 27 Jul 2023 09:23:17 -0700 (PDT) Received: from DevTop.lan ([212.82.82.3]) by smtp.gmail.com with ESMTPSA id z13-20020a5d654d000000b00314398e4dd4sm2457471wrv.54.2023.07.27.09.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 09:23:17 -0700 (PDT) From: Harry Geyer To: Till Harbaum , Andi Shyti , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: harry.geyer@devtank.co.uk Subject: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver Date: Thu, 27 Jul 2023 17:22:55 +0100 Message-Id: <20230727162255.21551-1-harry.geyer@devtank.co.uk> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Patch allows usb devices with multiple interfaces to use this driver without this driver assuming all interfaces are i2c-tiny-usb. Signed-off-by: Harry Geyer --- drivers/i2c/busses/i2c-tiny-usb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c index d1fa9ff5aeab..1bffe36c40ad 100644 --- a/drivers/i2c/busses/i2c-tiny-usb.c +++ b/drivers/i2c/busses/i2c-tiny-usb.c @@ -222,6 +222,10 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface, int retval = -ENOMEM; u16 version; + if (interface->intf_assoc && + interface->intf_assoc->bFunctionClass != USB_CLASS_VENDOR_SPEC) + return -ENODEV; + dev_dbg(&interface->dev, "probing usb device\n"); /* allocate memory for our device state and initialize it */ -- 2.34.1