From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6025C001B0 for ; Tue, 15 Aug 2023 06:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1zOuQPyyfLPrmUKrNdkBXuwjB76ID3u2dA4ZoehGH4k=; b=sFxCo7YEjANM2m 75r/DFhWDw4pcO2ji3UbYLzsIrb36NPeeJZ0scQKjSzw1WTn051iO65kgwE2mRtCJdQVsJTVE78hX 91ijId+00UNAeFjNXMAMbjaynE6dBUSluVRqIUuL7n/vYT/dSr6tuMm5O855ZQvuyyZ1fL1foEno7 Xd7kIAivO1aBvPGkyeoJu/mhyJHeOW59Zi24ok0Uc27PuJjhpV7aP8Bsx3WvAk0hugWh+MvlBun20 sOx1gWBbI1b+FYKNcTtLOxF4QOmvvknJv3Wd3GVblv2FOKx/nyFUOc3zxROwJML8782tKEC56T2dJ L+WMeOSgFNu7m34m6L+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVn70-000xP1-1n; Tue, 15 Aug 2023 06:01:02 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVn6v-000xOG-1c for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 06:01:00 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe12baec61so45823945e9.2 for ; Mon, 14 Aug 2023 23:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20221208.gappssmtp.com; s=20221208; t=1692079254; x=1692684054; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ATuGiDRRt6vLATPUxSeo+7i81xqN5HyTALEXdeKA4F8=; b=SsENlgM7QwFBr4fyrbLmlKEqIOdsbrkBW2fnqHH5I2nXrhsqj2FyMeX3t7E9PdQGv6 4w3Q5NO2ODfd50GcDA/PcpYdIdFq6nutLetkQeTZxjhv6FLVuDYHZZlGMqLX3SeAkg/n 92909bebuwsmYgZ5i+5UQG5pUc6VCB1jV4+iEG7syt29d/2lbK49DGBeH45mJZgezNMI tug6zMwxljUWocIraQL5YPO2RD7mehMNmwGTdZdL4qDyCPcmGAMNogk1jMor8GFY6rNO /x7ESOnP5Re+gF9gxek0LS3Uq1kGzI2gzTBiE21SomQ/h2qnxDxC8lj49n6LWWFJOCC9 ak8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692079254; x=1692684054; h=in-reply-to: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=ATuGiDRRt6vLATPUxSeo+7i81xqN5HyTALEXdeKA4F8=; b=fTVgvbmz2S0OYyM6c87Cdjzrug6yANC0+DABEjNJ31w/BhJNyngs/E6x/vNbdO8GUp w7Hfa3MDQLE0P2goDQL3y0mDuo+nrfQcMcmWEyUlTc2oTb9954AX55vyUxzRB3ZEfHCi XRMf4xSajVGOv6mO09/KAxeLzu3Z4d6kY1jBNEfk5KTL/Wiez5fAIY8xoToXtY8colNG VRx/lCOPp9yUj7zyyppAoWa6ENRxCjTsRxxN+TmXmPJyYuHXc6f7/10iu2fEEdUFwTfO 8l4WBby+DKlX1SOEzra7xfVmPCAbZQLyBb8b4xv63V+sfh7LNrLnX8xilDePO0hytAJZ zPrg== X-Gm-Message-State: AOJu0Yx82N11a0DRLVQxD1Q6g4H0gROvJVcI9rCSdH9rBVjbuqi4IS2y hrc1u9SKc/tdsXrzTPeSTjaCug== X-Google-Smtp-Source: AGHT+IH8cmixjntyPDKCP530AEOMW0rBts8FuLSUpsAjovyOl5LT8jngycJtfLakdIg/yNABjQ9QLg== X-Received: by 2002:a7b:ce90:0:b0:3fb:ef86:e30 with SMTP id q16-20020a7bce90000000b003fbef860e30mr8635975wmj.10.1692079254020; Mon, 14 Aug 2023 23:00:54 -0700 (PDT) Received: from localhost ([212.23.236.67]) by smtp.gmail.com with ESMTPSA id l10-20020a7bc44a000000b003fc06169ab3sm19280308wmi.20.2023.08.14.23.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 23:00:53 -0700 (PDT) Date: Tue, 15 Aug 2023 08:00:52 +0200 From: Jiri Pirko To: Jakub Kicinski Cc: Vadim Fedorenko , Arkadiusz Kubalewski , Jonathan Lemon , Paolo Abeni , Milena Olech , Michal Michalik , linux-arm-kernel@lists.infradead.org, poros@redhat.com, mschmidt@redhat.com, netdev@vger.kernel.org, linux-clk@vger.kernel.org, Bart Van Assche , intel-wired-lan@lists.osuosl.org, Jiri Pirko Subject: Re: [PATCH net-next v4 3/9] dpll: core: Add DPLL framework base functions Message-ID: References: <20230811200340.577359-1-vadim.fedorenko@linux.dev> <20230811200340.577359-4-vadim.fedorenko@linux.dev> <20230814201709.655a24e2@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230814201709.655a24e2@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230814_230057_755827_CFB7778F X-CRM114-Status: GOOD ( 16.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Tue, Aug 15, 2023 at 05:17:09AM CEST, kuba@kernel.org wrote: >On Fri, 11 Aug 2023 21:03:34 +0100 Vadim Fedorenko wrote: [...] >> +int dpll_device_register(struct dpll_device *dpll, enum dpll_type type, >> + const struct dpll_device_ops *ops, void *priv) >> +{ >> + struct dpll_device_registration *reg; >> + bool first_registration = false; >> + >> + if (WARN_ON(!ops)) >> + return -EINVAL; >> + if (WARN_ON(!ops->mode_get)) >> + return -EINVAL; >> + if (WARN_ON(!ops->lock_status_get)) >> + return -EINVAL; >> + if (WARN_ON(type < DPLL_TYPE_PPS || type > DPLL_TYPE_MAX)) >> + return -EINVAL; >> + >> + mutex_lock(&dpll_lock); >> + reg = dpll_device_registration_find(dpll, ops, priv); >> + if (reg) { >> + mutex_unlock(&dpll_lock); >> + return -EEXIST; >> + } >> + >> + reg = kzalloc(sizeof(*reg), GFP_KERNEL); >> + if (!reg) { >> + mutex_unlock(&dpll_lock); >> + return -ENOMEM; >> + } >> + reg->ops = ops; >> + reg->priv = priv; >> + dpll->type = type; >> + first_registration = list_empty(&dpll->registration_list); >> + list_add_tail(®->list, &dpll->registration_list); >> + if (!first_registration) { >> + mutex_unlock(&dpll_lock); >> + return 0; >> + } >> + >> + xa_set_mark(&dpll_device_xa, dpll->id, DPLL_REGISTERED); >> + mutex_unlock(&dpll_lock); >> + >> + return 0; >> +} >> +EXPORT_SYMBOL_GPL(dpll_device_register); > >Is the registration flow documented? It's a bit atypical so we should >write some pseudocode somewhere. We have examples in 3 drivers with actual code. But sure, could use some documentation. > >> +/** >> + * dpll_device_unregister - unregister dpll device >> + * @dpll: registered dpll pointer >> + * @ops: ops for a dpll device >> + * @priv: pointer to private information of owner >> + * >> + * Unregister device, make it unavailable for userspace. >> + * Note: It does not free the memory >> + * Context: Acquires a lock (dpll_lock) >> + */ >> +void dpll_device_unregister(struct dpll_device *dpll, >> + const struct dpll_device_ops *ops, void *priv) >> +{ >> + struct dpll_device_registration *reg; >> + >> + mutex_lock(&dpll_lock); >> + ASSERT_DPLL_REGISTERED(dpll); >> + reg = dpll_device_registration_find(dpll, ops, priv); >> + if (WARN_ON(!reg)) { >> + mutex_unlock(&dpll_lock); >> + return; >> + } >> + list_del(®->list); >> + kfree(reg); >> + >> + if (!list_empty(&dpll->registration_list)) { >> + mutex_unlock(&dpll_lock); >> + return; >> + } >> + xa_clear_mark(&dpll_device_xa, dpll->id, DPLL_REGISTERED); >> + mutex_unlock(&dpll_lock); >> +} >> +EXPORT_SYMBOL_GPL(dpll_device_unregister); > >> +/** >> + * struct dpll_pin - structure for a dpll pin >> + * @id: unique id number for pin given by dpll subsystem >> + * @pin_idx: index of a pin given by dev driver >> + * @clock_id: clock_id of creator >> + * @module: module of creator >> + * @dpll_refs: hold referencees to dplls pin was registered with >> + * @parent_refs: hold references to parent pins pin was registered with >> + * @prop: pointer to pin properties given by registerer >> + * @rclk_dev_name: holds name of device when pin can recover clock from it >> + * @refcount: refcount >> + **/ >> +struct dpll_pin { >> + u32 id; >> + u32 pin_idx; >> + u64 clock_id; >> + struct module *module; >> + struct xarray dpll_refs; >> + struct xarray parent_refs; >> + const struct dpll_pin_properties *prop; >> + char *rclk_dev_name; > >Where is rclk_dev_name filled in? Leftover, should be removed. [..] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel