Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2759440lqp; Mon, 25 Mar 2024 08:28:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWl8zNdmgJLGPNCTmI87ra+Bzft9lzP9iqyDK5ypgIeRa2stsggP692MUjfUYk66i0EBRANOHheqGaZxuPuUCr52Hn7sLoz+w+EJLZyDA== X-Google-Smtp-Source: AGHT+IGvTW+fCJggKyvLymyK97wnMLyfufspECPNUZLFix9tJBSxKGBYeNdAFAbZoi2Ik1J2tLnI X-Received: by 2002:a17:90a:6f85:b0:29f:cf88:c2d2 with SMTP id e5-20020a17090a6f8500b0029fcf88c2d2mr6257228pjk.12.1711380503127; Mon, 25 Mar 2024 08:28:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711380503; cv=pass; d=google.com; s=arc-20160816; b=jE5Vqgu3c09AoknK7KLCe7mvQHR1tc/nTm3nC42Lbe00Ue70Ji7nRcw1pyx1umyx1+ ZI0ZbBwgs4YO/35+9+4LZbyr6B5UH41wusN1jZOnJWInFgJR5TSaN81P8NwI2M7J9m4S eBRyGkRstwwKugyI0gVVoyZiZZfGdvfzLxPv6xLN5wK6pW0ItZH7rxsN79WFve4CJU8O xPK5xI9i02WpdjhgcgqYzgMw5O9aN1StOgC174FuSbUScdr9zmkSwQDslwu6syOWgi7F 8FQ4LXPlTWAAFAWBfhN0Sa4APrrZWaNFIvhADh6vK7TDRkwolzSD6SPhlMt5/HLPj/aI tkbA== 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=OgU9ATmRZP6L3LpzuzX003fhjH7k0Ift0+MTIYapSoA=; fh=daxskhSZAYmHEUq8Jl4X/Urjyu+vfWRb8PA0TNEl5RY=; b=PkbMoNpf34FzpJ6fhie8pwr4SzZ++AU+6ECRR8R8F9UEQdFx9l44GSUb2MNdbyugzn Ym4gIflKd/0NZEqZbkxhvZEQr41sBG4iZelapwDu9EJsRUG+LilmPvIf2iKA8JmGIDY+ iVGT0CxM1g6xZx/NFZCn/FBzsrwKt7UO+iTzU9n3Ze5Rl/nJz4C02mN96+Ccps5U7TXJ /nvGzkdeqC231GzUajt2VvHejDmnnwFFYpfcjR81Qj5gpIShm68f36MALN6NgnhXtEko jvw21ic/72Uepb+bpvWbNXF7grleOPFUvaM3Kako/L1xlBG6SKSxksNeG9xoc3UjamXa TX4A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=0RqbUNoE; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-117022-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id me4-20020a17090b17c400b0029c7463f85asi12121493pjb.148.2024.03.25.08.28.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117022-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=0RqbUNoE; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-117022-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 3B4262E381E for ; Mon, 25 Mar 2024 15:21:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61A1715956F; Mon, 25 Mar 2024 12:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="0RqbUNoE" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 29F2A17C98; Mon, 25 Mar 2024 12:38:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711370339; cv=none; b=ZNJyhp2WT9qJkfNViP/IqydcXIZ9m1vleVGLW7KNYV809rj8N0wZ1nQ6uh9qCxKGVa4c5LDOW9zXoHNgNcWpltHym+kO3mPoq69URHNoBQyiu9moEX7YK8ytTkjRl5CbH5B3BFb8SA3bRbD6Ah/WjAQT0lRWvLM2qizBk9H6Pvk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711370339; c=relaxed/simple; bh=95OfuHhtUR61PCdLT913r4p58jGY4g4ttdpsQZMIHKE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eeNcAgp5PLkSy/LFAP6gCKouRzNFPEJfUaq6i0cY/DiuI3uT3HKAljumb4rbnoR7AkeeCsdgP3I9yirEU+cswfJvsFpxnWYkzQrMGO/w14eU9Wsp0iLI+ZDIl3sj4+M9IAzf/HXbu+rfOxFKQ/cuAj716pQ+zeVg9YsaxgMHxiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=0RqbUNoE; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=OgU9ATmRZP6L3LpzuzX003fhjH7k0Ift0+MTIYapSoA=; b=0RqbUNoEE8/paq5vSzmjLbsA0Y sOt8eUVaYwOPNeHqtcx3KhS/x2x6blQy1CxPXXwerD+QVRpCR2vY1bl2ErUJo0rDFAKujo3WNBq8L tPTw/n0r3KsZNg36bUs3LCOML00kYdGPmsFxOIgWZikBEOgNmLUX5enm+rsx75xmJs9Q=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rojb8-00B9Nd-5b; Mon, 25 Mar 2024 13:38:42 +0100 Date: Mon, 25 Mar 2024 13:38:42 +0100 From: Andrew Lunn To: Luiz Angelo Daros de Luca Cc: Linus Walleij , Alvin =?utf-8?Q?=C5=A0ipraga?= , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 4/4] net: dsa: realtek: add LED drivers for rtl8366rb Message-ID: <9ca3fc83-ef54-4080-bd77-b0f09eefc952@lunn.ch> References: <20240310-realtek-led-v1-0-4d9813ce938e@gmail.com> <20240310-realtek-led-v1-4-4d9813ce938e@gmail.com> 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: > static int rtl8366rb_setup(struct dsa_switch *ds) > { > (...) > if (priv->leds_disabled) { if (!priv->leds_disable) return; Saves you one level of indentation. or static int rtl8366rb_setup_all_off(foo *priv) { > /* Turn everything off */ > regmap_update_bits(priv->map, > RTL8366RB_INTERRUPT_CONTROL_REG, > RTL8366RB_P4_RGMII_LED, > 0); > > for (i = 0; i < RTL8366RB_NUM_LEDGROUPS; i++) { > ret = rb8366rb_set_ledgroup_mode(priv, i, > RTL8366RB_LEDGROUP_OFF); > if (ret) > return ret; > } > } > } This is what i meant by small helpers. And the function names replaces the need for the comment. This is part of the thinking behind the coding style. Function names can replace comments. And the higher level functions becomes easier to follow because you don't need to dig into the details to understand: if (priv->leds_disabled) rtl8366rb_setup_all_off(priv); Andrew