Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp398808lqb; Thu, 29 Feb 2024 04:36:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU9qf7wkyrUpOBFP4o5eoGf0gxCY1bDrsAfDMXhl3cNkW/nR0I9qjnVW/camHhMuj2p0O0eUyLimPM6Yl0fbAZnBWxW23HbaiIyixhn1A== X-Google-Smtp-Source: AGHT+IGI+PwLNlqxLT1bxgjeaGRg0b3r/cZBd6eYhShQxtOf3Bl8MlY+47M1GVYLQ6Pyd/+d9wL2 X-Received: by 2002:a17:90b:795:b0:299:ecd0:483b with SMTP id l21-20020a17090b079500b00299ecd0483bmr1986679pjz.10.1709210188768; Thu, 29 Feb 2024 04:36:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709210188; cv=pass; d=google.com; s=arc-20160816; b=IESr1mI6cqYHmMlngVvvUEy5nT6bNzjr3rmdxzAvM02foI6U1QyQVRLUS6APBY/nTB QyXURRFHuggK1bqfKwuIhIu5XKMwwJxPr1iIp66By/oSnikZKmyNQU7H11zKrvIswrlm +G+MtnAzgNsWUCCZtZtT3U+MpJeRwMPTWG9dj/50+1xvGR+WQ5LqNHX/Spiicz7D/HuI 6JIXjLAMFNi8zBJb9VOVLyhw7UF3CO2v2osYfWu0EfJIWVD4Abpmifra4F01Mj3Z8UC+ VjaSjMNS6kGN0YOLia7NhTXpCrHHocNYVbs1N0i94GqIeh/W3gq6v0yrlMnISPbZ2iIE arHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:cc:subject:from:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=rivbcy22OyT/FZEzxvNP0xJkQRC61DIMcbwv6BnP3xA=; fh=8OPJxXJt+9guaPfltkjoVN4IrQzLualQ8x21AEupJAQ=; b=041LJPvt254duicXL4SBYQovl+/T5kLmJf8OHacMCYOqh3H+36HsVsYwD/en45QeI3 XkccuX8m/Y+pNo0xhMjEadBFJSzYWzcziEoUcwCoVAKLFXZ9jr5WpN1pe33u6LCAJ8fg SSuiL6PZiefXd9h9+TfliTfafzdKeetFfH8UYGY10zCe5MN06zgQ5jEkA5Yeq0bpxgLU MbRfzSVlG3QpCsQB92XBNYzMaQWWGoz8ddpxam4Da4AtzCFNQDcn/HmJR0kLPV8lHiXV 6sfkHd/xMHVGv5tOc9tEnpQe6TEhh7BwMnpHndXzfMBDyScwnE3Oh+eomiRULbQZqe+n RKiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=IH3OE8JS; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-86684-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86684-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id sv3-20020a17090b538300b0029abdf3f21esi1462408pjb.34.2024.02.29.04.36.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 04:36:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86684-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=@bootlin.com header.s=gm1 header.b=IH3OE8JS; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-86684-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86684-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5AEB0289543 for ; Thu, 29 Feb 2024 12:18:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A30A7D06B; Thu, 29 Feb 2024 12:18:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="IH3OE8JS" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.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 40D197CF36; Thu, 29 Feb 2024 12:18:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709209102; cv=none; b=tBkGdz+23UYNkmnG1XCugqBW0GwbJd7/zjAjzZql39izeMApN2iyA0WmXuYhBAavGIRT+jHii94Nt5f4YgDEhdlx6FmRk+fATjwSECMSBKpmqYr7Y4Gy0lFRwQsv7TcX9zRpQl2s1KxbnjcCUHVlGRQDo+UQR5NdeHe+LkzMX74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709209102; c=relaxed/simple; bh=8Eelp2TJHh8fMmaYaoIG0d+mIvZQwLFJthLx9DhOBLg=; h=Mime-Version:Content-Type:Date:Message-Id:From:Subject:Cc:To: References:In-Reply-To; b=Ip0fJ9t44tOw2MzgmEqROg+gRRP2vS436OH4V3AtPLe7zuJFLywMEyTK9k9YWk6ZeiAONJxMZYx6gRYMOqOTSNYFDB0yZC+U3UwzPw2s9ga4UhDEf+rOjn4mk3b4NYn58QTQ0o+PDhIWRP3Zm0afdq4LI70zoSur3fe5nf2x1bk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=IH3OE8JS; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id C64F31BF20A; Thu, 29 Feb 2024 12:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709209089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rivbcy22OyT/FZEzxvNP0xJkQRC61DIMcbwv6BnP3xA=; b=IH3OE8JSAMKn+Ls6dirQEB0XuO2Y6HcF9GIJPUJoHwnocUzLz7Ez1whX6c3fgNaTzwz6W4 NSefEg/uekQgeRhfCZOQuVsTXCrbS7xgiAJOy+RYmvY7f6a9uIQEqInD1RHHK2nt9Xyt2p SsJSO4zrN3IwB38ObMZ5Ynu417CznPxN2vQKd12LMYDmAI8bA2laQiALFUAWDRJaS/BPHE Z/4VCACO8BMVmQZy0aJND/4zDvsgv43KhtR0EwjOo0tDwGEM0zmptCMTQsd8pCuT07bfxq MBzMHCxh6oJLiIaPh2Q4jxl9Hxlnd12EtMfGqhaT5GVGLJShK8gIFkdxHpgoEw== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 29 Feb 2024 13:18:08 +0100 Message-Id: From: =?utf-8?q?Th=C3=A9o_Lebrun?= Subject: Re: [PATCH v8 04/10] reset: eyeq5: add platform driver Cc: "Gregory CLEMENT" , "Michael Turquette" , "Stephen Boyd" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Thomas Bogendoerfer" , "Linus Walleij" , =?utf-8?q?Rafa=C5=82_Mi=C5=82ecki?= , "Philipp Zabel" , "Vladimir Kondratiev" , , , , , "Thomas Petazzoni" , "Tawfik Bayouk" , To: "Andy Shevchenko" X-Mailer: aerc 0.15.2 References: <20240227-mbly-clk-v8-0-c57fbda7664a@bootlin.com> <20240227-mbly-clk-v8-4-c57fbda7664a@bootlin.com> In-Reply-To: X-GND-Sasl: theo.lebrun@bootlin.com Hello, On Thu Feb 29, 2024 at 12:22 PM CET, Andy Shevchenko wrote: > On Wed, Feb 28, 2024 at 06:04:47PM +0100, Th=C3=A9o Lebrun wrote: > > On Tue Feb 27, 2024 at 6:27 PM CET, Andy Shevchenko wrote: > > > On Tue, Feb 27, 2024 at 03:55:25PM +0100, Th=C3=A9o Lebrun wrote: > > ... > > > > > + u32 offset =3D id & GENMASK(7, 0); > > > > + u32 domain =3D id >> 8; > > > > > > Perhaps > > > > > > u32 offset =3D (id & GENMASK(7, 0)) >> 0; > > > u32 domain =3D (id & GENMASK(31, 8)) >> 8; > > > > > > for better understanding the split? > >=20 > > Do the additional zero-bit-shift and GENMASK() help understanding? My > > brain needs time to parse them to then notice they do nothing and > > simplify the code in my head, back to the original version. > > In my opinion yes, as you exactly showing the split. > But. The better is to use FIELD_GET(). I'll go with the FIELD_GET() option! [...] > > > > > + priv->rcdev.of_node =3D np; > > > > > > It's better to use device_set_node(). > >=20 > > I don't see how device_set_node() can help? It works on struct device > > pointers. Here priv->rcdev is a reset_controller_dev struct. There are > > no users of device_set_node() in drivers/reset/. > > No users doesn't mean it's good. The API is relatively "new" and takes > care of two things: > 1) it uses agnostic interface; > 2) it doesn't require any firmware node direct dereference. > > The 2) is most important here as allows us to refactor (firmware node) co= de > in the future. I think I get the point of device_set_node(). I still do not understand how it could help me fill the ->of_node field in a reset_controller_dev structure? Should I be using device_set_node() to fill the struct device pointer and the reset subsystem, by some magic, will pick this up and use it for its own of_node field? I've not seen any magic/code doing that. [...] > > > > + priv->rcdev.nr_resets +=3D __builtin_popcount(eq5r_valid_masks[i= ]); > > > > > > Please, use corresponding hweightXX() API. > > > > Noted. I did not find this keyword even though I searched quite a bit > > for it. "popcount" sounds more logical to me. :-) > > Hmm... But it's fundamental, it's called Hamming weight. > https://en.wikipedia.org/wiki/Hamming_weight Makes sense now. I've always called it population count following the name of the matching instruction on x86 (and I believe other ISAs). TIL. Regards, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com