Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp819868rdb; Thu, 15 Feb 2024 17:16:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbqeH9EUyBBsBqpKrsubtU/u3DRgldiuJANc2dtqQjihz0fzY+h298LHHANipnp1SZF4ZKba4hiDcj2mmr+sP1Bbt/wEgg2kr8pFsmjQ== X-Google-Smtp-Source: AGHT+IGzoPZYp8Mvv6mDbIB8o0h0cPZl6Gb16azg4A8WCq6kbaPbFjq3ibxV8iXVlEnPoG6KUPuR X-Received: by 2002:a05:6808:643:b0:3c0:2bce:7109 with SMTP id z3-20020a056808064300b003c02bce7109mr3316999oih.30.1708046192759; Thu, 15 Feb 2024 17:16:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708046192; cv=pass; d=google.com; s=arc-20160816; b=NmS+oWl2/vxVUf+JG7UpUl3qLK7X8kETErMLJoB9CMfgXJrIL30RyQv8QjYPZ7vxNk ldY0A6Qk6I/2piDn7Ir1tYNZ/6J79P+S7uDhW50CvBobE+viuJuIKBauc67CGGWiPlcR nwL/fnWEtdnd9O/xsm+oeinRAiwxUh1RNrDCNndUoVzYHUuyrpT1EEmzia4MCgf7Xudm WKhnFBC5nugVmlc+UW9665t8vm5XXf4tfRBxmjbc5vuz+SJZfC4kCG+Tr00MjzQEIefJ XhQF08s6k5ZdFnRQOq4+872scVG5uRzUD3+RjqptRA2MkIubPYV9YXLr2Tpl0TvD+MCO RMMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O3eF6Xf0QzOmLsZzpe4pKtQUe75xBm3R5yP9XkNOOLw=; fh=EPjt3meZPUIeP6BHvS8/d36gheL0PNFwaxQ/dCmTx2Q=; b=ygARmQwR1a1IPuJQVciTv/xAmEtf5I7Jj2aZFmkQvksLGvVeb+ESEZANw1dcB0uF38 88Ct0tFtXD9EIZ5TLeR8+vxn+HS1qO0s4wY1vIruTEQ8+CuSnM9to8GDhAMz07CQ2apQ Zkn0OaRUQ+Px0stpJ4ce3Q5DRKBNg2472RRJadwmRkwZHOp8Tu54OM3PbIrP34wQ1ebZ pN1FNJdDZXKZGkqGjHASwd/qb4BhQ82Cfu0yvYMKqIzQ9PBTypfvPNtGH3mI33PeAkzn FreSJrW2ockGAfZOwIWUI31cmUKlmxSyMj4i3zC4lcwkUGJWyA8Ai34Cp3hOnQVS1OIg rEhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="T/PnqKO8"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o11-20020a0562140e4b00b0068f2ba3a9d5si1562994qvc.56.2024.02.15.17.16.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 17:16:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="T/PnqKO8"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 612EA1C2119D for ; Fri, 16 Feb 2024 01:15:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3231D512; Fri, 16 Feb 2024 01:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T/PnqKO8" Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EA13C2ED; Fri, 16 Feb 2024 01:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708046151; cv=none; b=QktbZRBu2jkNXPZgmMnzTCnXcPFzsmy9jap2QXEKj86Vye6hqbTqj6Qm+uk+EvsmOBMqKwAXRH1EIJyl5Fl6mNSXNT0qMmKA4BB5ZWSefFrOm9DeviFd4q2hMneu0j+xmSFshCWsKHl6o/CpdCaRKgo0W5ibx+CdRR8U7KRn9X4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708046151; c=relaxed/simple; bh=RvGKWOwdrkRtqJpsZ/aXi5VrDq0Nk4AQAlyxMvr+iH0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pX6T2W+12Jhck4P8WlPpYFkSgujvs2BbQiOG9GYgm3ZV1oMNTW54VkVKEtUOVQSf4+V6Qx+SWPRN7KU1sEn09nsTQfzeNO3dd0ppizoQvhv1bCUHD5LlXSldk7SwVBMVbTCanL/tH5DHMcAJWTR8Oqfyk53LVBnxc782F3jYv2w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T/PnqKO8; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-337cc8e72f5so181610f8f.1; Thu, 15 Feb 2024 17:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708046148; x=1708650948; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=O3eF6Xf0QzOmLsZzpe4pKtQUe75xBm3R5yP9XkNOOLw=; b=T/PnqKO8TIWkPZcAFcSwY+aHmo/9QuA2z2rfFhc+lqA5sM7YPUPEHYQHouxnXvLSdM jgHd/jnIB9ndO97JwFtPB3zSgRBGL7oP4QYkvUqCaQRh9jEOxvncXPBfYJLGb2+LNi7Z 6OMXOR4lSP0FOoeVnYx78L9s+99bLLr2y7gJc99pzXiz8C+8mhYUFQu/mtefLQWRLjSc tvxIiRX5A40kOpE85fiGA/Vjmo3CYBJxaXdCCvDnKHXGyOFT7EEaOui7vk3S8fAshnAz 8EBx66P8tRT5zIDmB/04uT+E3eb879iMfSSiIaVjiOp5+/Rqo0USJul/2CGRFjwMh17J A29g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708046148; x=1708650948; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O3eF6Xf0QzOmLsZzpe4pKtQUe75xBm3R5yP9XkNOOLw=; b=MY1UPDDuoZYCuFg4+mxms7lddZuMUYS8J/xC6AW2XKT3f/p0IkudgFVwHEnkW7t9HX SGTwBHL3vHkbuaYIdV/9wiROwYDoh8BAz/n6wZ/s6mvgZ7XvBocbc2kzibj29JL8eVW4 2rkuntqrGQLYvI2VZkowOBvdwqsvAkouDPJMfmjMvDcSyF6uWyB8xKXDjS5+N/REHUkU btt6HhMGLquPXGLkZBBEj9CpRiDMIKIX8E0sSpRQ7XbHCBEsLwVp0sQ03be3B1vfEzTX oIs+13O1Go9KN1DKY/AuOP9mV4YmByODi4d0TzL+DkXr+6tFzMFuP4jxJclngYs9sz1B IIGw== X-Forwarded-Encrypted: i=1; AJvYcCWeXk1flsS4DCjFir7bADGAdjiDxPWuvZIvQX8yW/Fn6K3KzbyqFLOnFQRnTEYLC6kMQHKnZiNR3dA3oYBym39OEoa54tRtNPnP5X27S78mRhpOAgL7IeN+gfZ4zjNZ1H0ymWzAFDWHoE+ql4/TV/xcS5ViQ5/E4L02A42ipY/WjQ== X-Gm-Message-State: AOJu0YzfKhoBnuwgK8312+2hkeiRVGTuA5v/sx5HJ0QIiF/iui1Iyf8L f3k3HZRVnYzLQaYs6bs/bAHqfL5k02aTlpm+WpSpF1LNNLJM3PnF X-Received: by 2002:adf:a4cc:0:b0:33d:ca9:1fb9 with SMTP id h12-20020adfa4cc000000b0033d0ca91fb9mr2080936wrb.53.1708046148057; Thu, 15 Feb 2024 17:15:48 -0800 (PST) Received: from skbuf ([188.25.173.195]) by smtp.gmail.com with ESMTPSA id bw22-20020a0560001f9600b0033afe816977sm649518wrb.66.2024.02.15.17.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 17:15:47 -0800 (PST) Date: Fri, 16 Feb 2024 03:15:45 +0200 From: Vladimir Oltean To: Luiz Angelo Daros de Luca Cc: Linus Walleij , Alvin =?utf-8?Q?=C5=A0ipraga?= , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v3 3/3] net: dsa: realtek: support reset controller Message-ID: <20240216011545.7fmup2qkqikvb7ro@skbuf> References: <20240213-realtek-reset-v3-0-37837e574713@gmail.com> <20240213-realtek-reset-v3-3-37837e574713@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Feb 14, 2024 at 07:17:55PM -0300, Luiz Angelo Daros de Luca wrote: > > On Wed, Feb 14, 2024 at 1:54 AM Luiz Angelo Daros de Luca > > wrote: > > > > > The 'reset-gpios' will not work when the switch reset is controlled by a > > > reset controller. > > > > > > Although the reset is optional and the driver performs a soft reset > > > during setup, if the initial reset state was asserted, the driver will > > > not detect it. > > > > > > The reset controller will take precedence over the reset GPIO. > > > > > > Signed-off-by: Luiz Angelo Daros de Luca > > (...) > > > +void rtl83xx_reset_assert(struct realtek_priv *priv) > > > +{ > > > + int ret; > > > + > > > + if (priv->reset_ctl) { > > > + ret = reset_control_assert(priv->reset_ctl); > > > > Actually, reset_control_assert() is NULL-tolerand (as well as the > > stubs) so you can just issue this unconditionally. If priv->reset_ctl > > is NULL it will just return 0. > > The idea was to avoid gpiod_set_value if the reset_control_assert was > configured and worked. However, I don't see a big issue in calling > them both as you don't expect both to be configured. > I'll remove the "ifs not null" and let both be called. In the defense of Linus' comment, your proposed code did not do what you seem to have intended anyway. If priv->reset_ctl was non-NULL, it fell through and potentially ran gpiod_set_value() anyway - there was no early "return". So, the simplification comment was predictable.