From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 442452222B2 for ; Wed, 18 Feb 2026 00:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771374916; cv=none; b=Ij3N9q0BTg1KHvQBUXHgrRSgFCt+tABSsq/npDOLt9vnsHnlOL0dY/CEKLZIQW0CMkbud8EFcNFRfALWPW5hedDW9IyLb9lHNW2Ow3/p/ODbUalSlQZ3uXJdph7Qk7+0bfIWilss5d/DFCGFWFENfWOYeWmMgOmdTIjLnX8QFnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771374916; c=relaxed/simple; bh=qdvgxZcv0ESuBA1Jt7oAm5we9rLZ1s8OEqGJPW/lJcA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SLR3215727PlEPGP1/DiwXR9G2S3uxN1i81LIAWzYFU6W/xEkTDgKXqZzEjrrGGm/7+s8Jdfr5PBONdRqm+x83ZkqJ+iFQSWHMyN61+J+mRx6Zh1H/u0bYXg6FdyZi0UO0t/8EItjMf7AYxAsXpFx8advNFWSlq5UVbdaX1qsqU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Qkb265rx; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=cHbnzZH1; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Qkb265rx"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="cHbnzZH1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771374914; 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=2GFKu2pbS4lNbKn6Jz4fUhg2OnmZkDZP9P6vjWAZkDc=; b=Qkb265rxBzDOP4OGZNlzl/wdPwfxqkqWpII2D6emQKX+Yl+itLWQftLFRmmBRnjrfGy4ST DrTCPmodQPrgeJF3nJxqJlmKB4DW89Od5gfSU5PDpD5yYrDIcPcr1ktVYK7f8mFcPh8wna 9sjaxzNVw3vct73EH604WA9T63VsH7I= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-Sx2wS4crPRKA7nXHx2sIFA-1; Tue, 17 Feb 2026 19:35:13 -0500 X-MC-Unique: Sx2wS4crPRKA7nXHx2sIFA-1 X-Mimecast-MFC-AGG-ID: Sx2wS4crPRKA7nXHx2sIFA_1771374913 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-5033b62efa7so387839711cf.1 for ; Tue, 17 Feb 2026 16:35:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1771374912; x=1771979712; darn=vger.kernel.org; h=user-agent: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=2GFKu2pbS4lNbKn6Jz4fUhg2OnmZkDZP9P6vjWAZkDc=; b=cHbnzZH1WSqWqtrHWUVvdat7hwMwBx/BDT3756rn4fgaq4WrTTDVLo9RqVRc5hh13o 4m3cEmlSLtdbA3Qn3QUXHD0OG4iZnhaURTx6Y7kv64BCxd6tVzzY+ZqFjdogkf9wk7B0 4ArTC/nBK7kO2013zQYvBt9cTiFLF7NUKVtr6qe8cKU75CL09goP9nBPBRcxWsBJAGAQ 8gGDBeJOxb24G5N69OdAq7idCFvPEqTSm839IGtSVQC5esvpbKJmpEpgWP83Z5YwpHvO s8UVzgIwYR3V6qQOm+IL3qulqxiX/QfdW3sF+uiSZ8Fnajn+ZYWuoISQLClEavQa7nf2 muLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771374912; x=1771979712; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2GFKu2pbS4lNbKn6Jz4fUhg2OnmZkDZP9P6vjWAZkDc=; b=Kckdau6/WCv4zvX/kbmJPFhmImptJlA24Y+ljvlBC3Xk1dozMbdTCTuCvFOCcn4xWd Q1O20xPX/lVvPWx+I5UvK1ZE2TZHVkTlnnodVG0hGknD6tPhB/ceEgggzNzF46U9+rYS qp9HP27VGHGAtqTHJWrEW/0uTwBiY9SvGguadZaY+AUg2vrrZU/Dni0qR/lC4iDFnIhL y1kdCME5OEILoKQzFe2Fx9iWghpNeTqShHgkn9+vWt3Lea766Rb0Ppq7iLGOXblnc9NZ 7neP2Dkjbx7M4LqYP+spD9ENAgx9SnKAKOr2WN830i2kVDmnoEHyHG3Iuc/jMzWrwm5a y5rg== X-Forwarded-Encrypted: i=1; AJvYcCU5iPU83iaYTvGma/6jHvsJy9hn1adiHoijrJWS2G+C2A+B2GjifSfq30mRdRd5AggoyR7iPaH6fru5nqA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4+U/zebFzWT6AuBRMkdVHpxkM1djdq7H/VQmMkYlGO+uILn6A HpTSvMJQSyp2SRyEgW0Lp1whIxXVpVAiEZHD8189ZLhEOlMuoyOwB+SsCvdTNwFJlv3C0vYJLLM nfuwim8eSvq3pnU3GwqU8sy6uDkHw9pR/GJO4axA+HsCGYeJAb+A0dVwPMl0Cj52Ycw== X-Gm-Gg: AZuq6aLRWns+vIl1WQyvKpXax5/HHCK0cNubpDab4Mz2d58i+w/8Bq9UavSFQoB6OHC suTC/EFNRxhxS1rKsbLx/wTs2I8GLe73ZWnRX7gybkvILiYfWAVBP588VAehTctpyzwfPxXqdPb gQ1ydyWAYqTVLXiUi+5E3orROAmzyr+T/g3CXXjOXi13WDB86YIIvSQblaBRxVaMzogvz7Dt9Hy +YbzShCny6lPPG0ZVcBjwPvxQP6l2LBiVcdrBoxvT+ph6x2CA1clobVRRoDr05FqxX4q50+RyWr 3w5VSyzl7ldYLtJ+GlLIeulsWOrFOmX5xK56owGIhkFCbKLrzVBrUVcUe+yeSltzbM5pWoxqZI4 BcAMW1cu4wckiXap5bTocTo1AG/vYBoaOZXcojNwyuX5BQFje6/L3s2ky X-Received: by 2002:a05:622a:1443:b0:502:9abb:c919 with SMTP id d75a77b69052e-506e9153b78mr3429771cf.10.1771374912630; Tue, 17 Feb 2026 16:35:12 -0800 (PST) X-Received: by 2002:a05:622a:1443:b0:502:9abb:c919 with SMTP id d75a77b69052e-506e9153b78mr3429291cf.10.1771374912045; Tue, 17 Feb 2026 16:35:12 -0800 (PST) Received: from redhat.com (c-73-183-52-120.hsd1.pa.comcast.net. [73.183.52.120]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8971cd8aff6sm174993256d6.27.2026.02.17.16.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Feb 2026 16:35:11 -0800 (PST) Date: Tue, 17 Feb 2026 19:35:09 -0500 From: Brian Masney To: Anirudh Srinivasan Cc: Drew Fustini , Joel Stanley , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd , Philipp Zabel , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, joel@jms.id.au, fustini@kernel.org, mpe@kernel.org, mpe@oss.tenstorrent.com, npiggin@oss.tenstorrent.com, agross@kernel.org, agross@oss.tenstorrent.com Subject: Re: [PATCH v6 3/3] clk: tenstorrent: Add Atlantis clock controller driver Message-ID: References: <20260216-atlantis-clocks-v6-0-cb46d6a59c73@oss.tenstorrent.com> <20260216-atlantis-clocks-v6-3-cb46d6a59c73@oss.tenstorrent.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: User-Agent: Mutt/2.2.14 (2025-02-20) On Tue, Feb 17, 2026 at 05:29:56PM -0600, Anirudh Srinivasan wrote: > Hi Brian, > > On Tue, Feb 17, 2026 at 5:22 PM Brian Masney wrote: > > > > > > We have a group of gate clocks that have a single enable bit shared > > > among them (instead of individual enable bits for each clock). We need > > > to keep track of the number of clocks within a group that have > > > requested an enable, and only unset the bit if all the clocks are > > > disabled. share_count is used to keep track of this. It gets updated > > > by each clock. Hence it's a pointer (and the mutexes around access to > > > it). > > > > The code currently has: > > > > struct atlantis_clk_gate_shared_config { > > ... > > unsigned int *share_count; > > } > > > > That pointer is dereferenced like this in several places: > > > > need_enable = (*gate->config.share_count)++ == 0; > > > > I don't see why the pointer is needed. Can you drop the pointer > > and the dereference like this? > > > > struct atlantis_clk_gate_shared_config { > > ... > > unsigned int share_count; > > } > > > > need_enable = gate->config.share_count++ == 0; > > > > In this case, wouldn't each atlantis_clk_gate_shared end up getting > its own copy of share_count? Which is not what we want. Or maybe I'm > not quite understanding what you're saying. > > Every time we create a group of these shared gate clks, we create a > refcnt variable like this and pass the var to all clks that share it. OK, I see now. Thanks for the explanation. Brian