Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2427529rdb; Mon, 12 Feb 2024 04:48:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSx1bCOmj17kJZTF4pet75iNtzyO1f6nkCLsxwOrPzSeW3Md3X49mL6qPfxj1Go+co8dar X-Received: by 2002:a17:902:d505:b0:1da:3266:69b2 with SMTP id b5-20020a170902d50500b001da326669b2mr2129362plg.23.1707742111742; Mon, 12 Feb 2024 04:48:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707742111; cv=pass; d=google.com; s=arc-20160816; b=HW1xq02txrdcdTojl2rZYeUzW6DA1yYx6yPCCgW46AA40qI7HjrZB965sTrDdSfoLg /9jpFZeAdgMWNJkEyQ/zOsr8jqgi3GzgYNADSGTQXPSOVfNc3ssq8z5q5iOcFavCCo3t m3dJg/sDxzjfyEpMHkFkjH7tf8xeDuu2piyqUnsCASuFkiPLxtLSshSPFgbbAPijPBDs NGN5AKgUxxtsaQpDNvpbkheGG/YX+d/AREG8VuKN11sQT+YNQUDEAwpo6ftHDUaEb2dk ZiCW3yZ9cMVL07H0Tgbmbx9FUwu+pbYd08iOqgxA7oq/Yvd5+mbFmB/ox1fVFefHBlOh osvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tBrnzO541cs7SIAzUXQMlWc3spq+LsARIYoFkSbMOEM=; fh=+QrqQ62hplvkp8yyI42gfodsnTWL3yElIOdvwlix91o=; b=0rtC6fYkM5blPsfn/sBdLJnLUB1ygbk8GNWOB5LY0Px/9szOsq3dVzks/JzWqmum9s dG5kJtgdjQSueqTkvp9/vw78ekq/UhNCPhfoTQ41GZRZOKj2YhbybA3giqQ32K9N2ZaN lN/NrmF7iJpQx/6qoLYglq62nMtA6jaOcsc1dRNJXlhxXSfXJeGyZNXn1awIhKP43raD QxhCUyD2bvlBkxeIsypg2e7tG1vkc+9dw/g/iuFqZfZc7uZX9RNG/N1quIhXEOrg+d5e Wgxiqd79sC+/34u29wHLgIDPLzsBW2S1sghdlDUJDmXtsYBb3J2MFik7GcUOt4GBMPhh r+hw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EdRFzBOn; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-61574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61574-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org X-Forwarded-Encrypted: i=2; AJvYcCWSjrRIrWFlFu+pN6R+rP54HpwDY+O0z0zN3nvAuNDWpwqmlO8cPgYslxk2pPIYm9RCw1DVG3BuoZgjYyS57g4yT8Fqj7nRhU2u4d+6gg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z16-20020a170903019000b001d8f10a6a0asi208065plg.353.2024.02.12.04.48.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 04:48:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EdRFzBOn; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-61574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61574-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5309B281412 for ; Mon, 12 Feb 2024 12:48:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E56013A1A1; Mon, 12 Feb 2024 12:48:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EdRFzBOn" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9CED1E482; Mon, 12 Feb 2024 12:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707742102; cv=none; b=bV0nVCeaLEEdp1/DaGItHkTZfJQy3xexmRMFjd53vPtE7Dr8DXc76f4k4V8Aqcmj5WOFOV7VIJUKY8/xdH8GZXFWqkDBXV5DX06Ko0U7SreDMjN58fkISQxGpsdk/Y+qiWnA0hznMAeX2uI6qIzDwwhEpsdLGl40vVtO3QeK0T0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707742102; c=relaxed/simple; bh=b/ETvNH0QRXgyQ+Z96RbxU4jW5NVr2/e7WLbdFuf5H4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JcwL/iND+qnZeDUkJnfYzPU/zreRhO4JQJ9iHppXdXtGYeg9PhZSCxQnRRaj7aSgjxQ+DNZrPtSQwdZQFrtgbMPTddEPQ7jUqYXDyxB/EmJvYxRyQbZyncHmxdjRq+oPYdtbSWARWRy3MFNjDNMTDc86RApZ2RLZLRMwVAX41S8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EdRFzBOn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D11AC433C7; Mon, 12 Feb 2024 12:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1707742101; bh=b/ETvNH0QRXgyQ+Z96RbxU4jW5NVr2/e7WLbdFuf5H4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EdRFzBOnTpS3rDSbuz7FiOBXtI6XSOgoSuWJK0FA4z60FXKMfDgtK/YYppokqwIaP mfGv7m58H9u97aYa3U1lMUzGlHo4aQYRbqTj0N4GaY7H3AYQ1aiAMH6kc8ZGAMktli RN/3FoKcmoVxYx7EckOkWb9BkTo5p0fXlKRyxOFA= Date: Mon, 12 Feb 2024 13:48:18 +0100 From: Greg Kroah-Hartman To: Konrad Dybcio Cc: Heikki Krogerus , Bjorn Andersson , Marijn Suijten , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: typec: fsa4480: Check if the chip is really there Message-ID: <2024021210-bacteria-camping-7e48@gregkh> References: <20240212-topic-fs4480_check-v1-1-d9969e4d6f9a@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240212-topic-fs4480_check-v1-1-d9969e4d6f9a@linaro.org> On Mon, Feb 12, 2024 at 01:01:30PM +0100, Konrad Dybcio wrote: > Currently, the driver will happily register the switch/mux devices, and > so long as the i2c master doesn't complain, the user would never know > there's something wrong. > > Add a device id check (based on [1]) and return -ENODEV if the read > fails or returns nonsense. > > Checking the value on a Qualcomm SM6115P-based Lenovo Tab P11 tablet, > the ID mentioned in the datasheet does indeed show up: > fsa4480 1-0042: Found FSA4480 v1.1 (Vendor ID = 0) > > [1] https://www.onsemi.com/pdf/datasheet/fsa4480-d.pdf > > Fixes: 1dc246320c6b ("usb: typec: mux: Add On Semi fsa4480 driver") > Signed-off-by: Konrad Dybcio > --- > drivers/usb/typec/mux/fsa4480.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c > index cb7cdf90cb0a..d622f4f3bd54 100644 > --- a/drivers/usb/typec/mux/fsa4480.c > +++ b/drivers/usb/typec/mux/fsa4480.c > @@ -13,6 +13,10 @@ > #include > #include > > +#define FSA4480_DEVICE_ID 0x00 > + #define DEVICE_ID_VENDOR_ID GENMASK(7, 6) > + #define DEVICE_ID_VERSION_ID GENMASK(5, 3) > + #define DEVICE_ID_REV_ID GENMASK(2, 0) Why the indent? And those are _VERY_ generic #defines, please give a better name for these so you don't conflict with other stuff in the kernel accidentally. thanks, greg k-h