Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2945694rdb; Tue, 13 Feb 2024 01:59:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGE3WM3CVbeUnHNotGBfVwIf2jeJDntcpnNectDyaLXmUkbAJGPWJon+NlrHPjAxeMICirW X-Received: by 2002:a17:902:eb44:b0:1d8:f06a:9d68 with SMTP id i4-20020a170902eb4400b001d8f06a9d68mr8820946pli.33.1707818397131; Tue, 13 Feb 2024 01:59:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707818397; cv=pass; d=google.com; s=arc-20160816; b=eNiiP25O4H+oArf/GX+UHKeJ1vdSKc+iektdTy99SzM9efEN8d51arM5K5rH/7+WOa V4kYyND45CGicPGqqUrGCvddG4tkXBJF+y+Zjs5EKt6rvBoKVHje8wIxT31dWpcKxkgP Ipx69ZyxS+RK8XkKxO0p4NsCxTGXDscq7ILFR3SczYjUkg/WcYyAsEM3iNI30Q0/btUF Y3yVrVbXNvTBuyrG334QvfOrvvhby84g/ELDNQbOEPJQnqCH99tKUBiijE12+eRvN27H iyQFU3a+RpfHqyC/2/75GTn0IWIkTFvEmboRcHE6prN5/WsqYsi4Ji23MxozJAm2jFfm r27A== 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=zimiGmZFYpotXY1df4QDt/ymZfqkd96J3k/E2fc59tA=; fh=D0IS7w5i8QMY1q+o87Sywa+I8WcpMBr25yed1UoNWF4=; b=vYRttkRnU8JyrqCoRw6OHfeLYvj8NoXo56xkZChNferUP2V/IN0I668vmQqZCJasdH 2a/enEnRET0oRKc1qKe5+fM1jpSw5tgk+vjH9LoUZ7T6B6NRurismvflXxkXnDUq4Dli olR29NnPqo63PucrSfRidDtibfbj+8h50KAOuf+laqIfs5yl+8Nv74NjTZfWFi860+Ak s0Hf941gRX3PAGWS5U8uigIq7CBlIvA5pj7VTDuqfkDJ0S+P1kGVtF28XvaKVg71+u/B Ssp8jp2TbBn9sZBsXF3kPYZr8VR2cPIbX9t1AZIfrcHEbo7TeVs10OaEAyvjvNobxRUn elag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1bJrnhf6; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-63261-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63261-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; AJvYcCUpdyptrybqHRsEVWwMGrheF/I+KaUA+iI0hVyHzbGgauKNb0TUDlrhK/N3tkpRP6wVc9qb1//8Y25u4thKl4TqWMUJ3JTolADwkdh7YA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id jk15-20020a170903330f00b001d9c1a929d9si1701252plb.472.2024.02.13.01.59.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 01:59:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63261-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=1bJrnhf6; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-63261-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63261-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 B56D928974A for ; Tue, 13 Feb 2024 09:52:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC0CC22EF4; Tue, 13 Feb 2024 09:46:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1bJrnhf6" 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 04B0922618; Tue, 13 Feb 2024 09:46:02 +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=1707817563; cv=none; b=ml2XW4UNc3UflbmwGAjpvhSSx97CqRA7JSlQzVmTTk6lVFfPkzGdC+zWlUESnZGlZeibulb9kYoOlfE8onXo/wpLtCfmaRWlmqH7p6FT2t94crrLizP5xrU6T4hHoamvwJewC9G4ykRVLs89EyaDHT7PgVgdkn7Grbs9npSIn+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707817563; c=relaxed/simple; bh=qFyWFT85f614iAFVoIyVBn+WeMGQK8ZHRIFpwhElMOM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PxE/RtqjfskAzFxj2F0xL6frdpS/XSYe40yPDzD7OH2KhYSwrqeBcVBeBB9NaC5Dai6PBMFTjA91+SkpPhXjWGJjNGh/+jH53fStg24T2J0jlycuHyQvr8uhLjjOMAQ8u1d84jBxaZZwjE9fMhKDPInQGpC3p6INO1wAp0m0FOA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1bJrnhf6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF90CC433C7; Tue, 13 Feb 2024 09:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1707817562; bh=qFyWFT85f614iAFVoIyVBn+WeMGQK8ZHRIFpwhElMOM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1bJrnhf67DJLiTD21dPyaLZBO99GI8qVzt0hG0n9s+xdf7+MdTft/ljiZVvgjPieW 26lzJ8vihGFIdd+rITru5+NP7rmbb4uJcJG65k9/cwu29rEf4a4ZEVV1ECNCoyYr/p die5ImPOelWX1U4ifC9iI116QEDPjO/TKnfWKcds= Date: Tue, 13 Feb 2024 10:45:59 +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: <2024021327-slapping-causing-c0ef@gregkh> References: <20240212-topic-fs4480_check-v1-1-d9969e4d6f9a@linaro.org> <2024021210-bacteria-camping-7e48@gregkh> <99749541-25bd-4cd7-be5d-e440472c6f0f@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: <99749541-25bd-4cd7-be5d-e440472c6f0f@linaro.org> On Mon, Feb 12, 2024 at 01:59:42PM +0100, Konrad Dybcio wrote: > On 12.02.2024 13:48, Greg Kroah-Hartman wrote: > > 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? > > In many places across the kernel, bitfields or possible values of a > register are defined with an indentation to emphasize the relation between > the defines Ah, that wasn't obvious here because: > > 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. > > If you don't mind them becoming very long, I can prepend them with FSA4480_, > and I suppose shrink 'VENDOR' to "VEN" and "VERSION" to "VER" to compensate Yes, prepend them pleaase. And no need to shorten the word, we have plenty of space. thanks, greg k-h