Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp870620rdb; Fri, 1 Dec 2023 00:11:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHumgOV0u7rCmquTL896RIdPYSd3/Piq2e81+CEfJzv+n0t8Ho6FdYmGZVuaobNUYl+UNIk X-Received: by 2002:a05:6a21:999e:b0:18c:382e:48f1 with SMTP id ve30-20020a056a21999e00b0018c382e48f1mr21214243pzb.7.1701418283124; Fri, 01 Dec 2023 00:11:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701418283; cv=none; d=google.com; s=arc-20160816; b=OXGdQVTQ7uBfb2ehAv/w0scZjvGYI1Gs7x3pZ/xDjGhEkYn0eyDiax6Zeidz2BfInB mNHr2v2aZYa8rxdqqRDwpetGfLsyM70uDC04Gl0D57Q4yU+HTyD8szI9mkgYav4IHzpC 6bHszAakn0wMr5kJ0XUjzNBKpis0Iws9WzgVX/40rmlf0aV6Ktnca3ODelfajTxe30ly tDcGGs44/Pkfumn7L1b7NxECA53y1cQufmkN30tE8O/5O5NsNNTfZX0pHUhr4opUz8wH DWj8REkMidBtDgKSHORCS7sGLTO2pj6wl7mV/7qaqEeBq2sTqRh1GrLsBIroR8AFsWvb QktQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MkyVSQh96ol4g0gFN8zCdss2LoPkvDDA3BxXeQE0dms=; fh=HJbIkjwRmARrw/LsJ7/tkMz1djEsvhjufHORnPP0lSk=; b=w/QzsMt1+UOYXA8RLcUczx1plyIeztj+0blgdAgF/S+8e6EaNyErd5n2Y3Ec460hwX B7D+IwXxT2FXt/psp2WDH9etmkoxHvn/tIdFeTj7B7rWYQpMgV2JfFQf3t+8JfUjza9m MN1Xz+MLzd5/WJlt8ecOyHBXRc8m8XEhjdAPpMNqY8RN+ESQeQF+Tgl3EyR4QT46BFDo 9e7uYWYlQXrz/+4+MFqrX+demlMXHLtWhGf3TBN5dTqk5VmDOy/T3Qyg1OthnSmfJgDO v6vjAyFVkeDJHuJK2PqTktQRE1kfpcZYa9poz837DcpMlaN4enLy5v6Xwo+0eRwxCOYc Rp6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=apSuMulP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id cp14-20020a17090afb8e00b00278f6d616aasi2842250pjb.71.2023.12.01.00.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 00:11:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=apSuMulP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 628C58142DBF; Fri, 1 Dec 2023 00:11:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377784AbjLAILE (ORCPT + 99 others); Fri, 1 Dec 2023 03:11:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbjLAILC (ORCPT ); Fri, 1 Dec 2023 03:11:02 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A108610FC; Fri, 1 Dec 2023 00:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701418268; x=1732954268; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=XXTiE0KX84FeRtROAy8E+cghO1kCf3YR1Lfb3hphWyM=; b=apSuMulPbRUWEOkcz/SAMv3r5pH5+QHHrnGii9Z5ZiFOKeol8TCqZ8oH wrS+x3w3I9B+sKeJYp3OX90OrS+XDa3jDvc/uA0HPYYcccLMgTTdIHzkG TbYdSE7Vsayq7KDqWT+ZBy0m8anj/6nDUnH6GBnR4sO6chHPUP4r454tB CBOMKdjG4/nttgptsql2vyjdm13B6RJ0gNcGYSDrpBw/ZD5Y0x1shkaMa FqozeOkj7RWNrHKs1Dhk9YR790PtLjno0nl6aiXVzVL5Uc0Q/BlGNwzM6 5J+Vya6JBTJGElWe8k0qvYrSCFqgxdeaOW6c4uFgZsz0c7HveeKmJwLFC w==; X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="397350523" X-IronPort-AV: E=Sophos;i="6.04,241,1695711600"; d="scan'208";a="397350523" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2023 00:10:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="803967888" X-IronPort-AV: E=Sophos;i="6.04,241,1695711600"; d="scan'208";a="803967888" Received: from kuha.fi.intel.com ([10.237.72.185]) by orsmga001.jf.intel.com with SMTP; 01 Dec 2023 00:10:44 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 01 Dec 2023 10:10:43 +0200 Date: Fri, 1 Dec 2023 10:10:43 +0200 From: Heikki Krogerus To: Roger Quadros Cc: Alexandru Ardelean , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, christophe.jaillet@wanadoo.fr, a-govindraju@ti.com, trix@redhat.com, abdelalkuor@geotab.com, Bryan O'Donoghue , Krzysztof Kozlowski Subject: Re: [PATCH] USB: typec: tps6598x: use device 'type' field to identify devices Message-ID: References: <20231123210021.463122-1-alex@shruggie.ro> <47ffbb30-34a7-4f5b-b262-3e068e574c8a@kernel.org> <292f5d48-8567-4b60-ad03-6cf70f71bacc@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <292f5d48-8567-4b60-ad03-6cf70f71bacc@kernel.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 01 Dec 2023 00:11:19 -0800 (PST) Hi Roger, On Thu, Nov 30, 2023 at 03:30:54PM +0200, Roger Quadros wrote: > Hi Heikki, > > On 30/11/2023 12:54, Heikki Krogerus wrote: > > Hi Roger, > > > >>> Why not just match against the structures themselves? > >>> > >>> if (tps->data == &tps25750_data) > >>> ... > >> > >> Then you need to declare tps25750_data and friends at the top of the file? > >> > >> A better approach might be to have type agnostic quirk flags for the special > >> behavior required for different types. This way, multiple devices can share > >> the same quirk if needed. > >> > >> e.g. > >> NEEDS_POWER_UP instead of TIPD_TYPE_APPLE_CD321X > >> SKIP_VID_READ instead of TIPD_TYPE_TI_TPS25750X > >> INIT_ON_RESUME instead of TIPD_TYPE_TI_TPS25750X > >> > >> Also rename cd321x_switch_power_state() to tps6598x_switch_power_state(). > > > > No. Functions like that isolate cd321x specific functionality into an > > actual "function" just like they should. > > > > Quirk flags mean that if something breaks, it will almost always break > > for everybody (there is no real isolation with quirk flags), and when > > things are fixed and when features are added, we are forced to always > > "dance" around those quirk flags - you always have to consider them. > > > > Platform/device type checks are just as bad IMO, but in one way they > > are better than quirk flags. There is no question about what a > > platform check is checking, but quirk flags can so easily become > > incomprehensible (just what exactly does it mean when you say > > NEEDS_POWER_UP, SKIP_VID_READ and so on (you would need to document > > those quirks, which is waste of effort, and in reality nobody will do). > > > > In case of tipd/code.c, it should be converted into a library that > > only has the common/shared functionality. CD321, TPS2579x, TPS6598x > > and what ever there is, then will have a glue driver that handles > > everything that specific for their controller type. > > Do you mean that you want to treat the 3 devices as different incompatible devices > so each one has a separate driver which warrants for a different DT binding > for each and also Kconfig symbol? I did not consider that, I was thinking that we would still continue with just one probe driver for all of these, but now that you mentioned this, maybe it would actually make sense to have separate full fledged probing drivers for all of these. Do you think it would be better like that? Would it be a problem to split the bindings? thanks, -- heikki