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 AB503C001DF for ; Sun, 6 Aug 2023 17:14:10 +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=fioMbAahgFyWxyCEZL+qffweyXIChk0Q3Nw/82X2YsY=; b=CIfmMs6CgahlvA mIdn3DwifK1wG/wB+gpXRTbqi1dEuH5gbouRAn8d6L8yymUzkAv49rVFd20FQtjuQQk+iw0cTig5x hNUbMTP20gc6geYPQUKT+fSs2HP07Ga6a6z9UHa65lJWYD/2rKe96L9YtGWgBeM9MEUDtVeNuEiAk zCuZH/ERqZrh3DwoOkBS4OI5AB+Fk2JOcOP60dR5HZOuesY7ML0KFWJRsNHDjUt+h4kUMwq5TTx1q DsVL/ENYK3/BjowKWWWLaaChcYVwCj0myi6U15ZJuT1ZRxuPYDc+pZU3jDTTeJnlN4u/J8p9lQ4zI ND7W+KOJwJZuvHwe8pdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qShK4-00FfDP-1Y; Sun, 06 Aug 2023 17:13:44 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qShK1-00FfD2-0X for linux-arm-kernel@lists.infradead.org; Sun, 06 Aug 2023 17:13:42 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EE1AA6119D; Sun, 6 Aug 2023 17:13:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DB64C433C7; Sun, 6 Aug 2023 17:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691342015; bh=8VwOuLhwvYu1ICpyXAxr3nOtAto35ExIqTjSqrKxShA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A7yDcOUAGy0TOQasoI8de3nHnwJ2aMJwoAgm5qc76YoNlTGrCKzDYGFSKUUCm2f7q 7GNh6F7t5sqjHV9GPTXeB+J+8OTqH17Xvfyca0Xk4Bt1DcMCbyJfOdiLU2bvzGGPnO BH99LhiUgcBc9+VVqN8ybZurWn4PRoUG26Zf4hQRs8y8wWOkfrmxTWMxXBHZ3mZX+z 5AI4KriL1loB13bBFWQh6RCxSUjORPKOc7E2OFmydAJAQ/X563ATbBkbTTkhdFpX4D JWdL/yJGiKpmELsGObQNWh9g348nszbZ47GNIBPKVUyFURGvioOqQfTzITiOlrIdI/ Cq40xjQ/3fxBw== Date: Sun, 6 Aug 2023 19:13:30 +0200 From: Simon Horman To: Vadim Fedorenko Cc: Jakub Kicinski , Jiri Pirko , 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 v2 8/9] ptp_ocp: implement DPLL ops Message-ID: References: <20230804190454.394062-1-vadim.fedorenko@linux.dev> <20230804190454.394062-9-vadim.fedorenko@linux.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230804190454.394062-9-vadim.fedorenko@linux.dev> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_101341_311791_12BFC405 X-CRM114-Status: GOOD ( 22.00 ) 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 On Fri, Aug 04, 2023 at 08:04:53PM +0100, Vadim Fedorenko wrote: > Implement basic DPLL operations in ptp_ocp driver as the > simplest example of using new subsystem. > > Signed-off-by: Vadim Fedorenko > Signed-off-by: Arkadiusz Kubalewski > Signed-off-by: Jiri Pirko Hi Vadim, ... > diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig > index 32dff1b4f891..e4da62ac9a9f 100644 > --- a/drivers/ptp/Kconfig > +++ b/drivers/ptp/Kconfig > @@ -177,6 +177,7 @@ config PTP_1588_CLOCK_OCP > depends on COMMON_CLK > select NET_DEVLINK > select CRC16 > + select DPLL > help > This driver adds support for an OpenCompute time card. > > diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c ... > +static int ptp_ocp_dpll_frequency_set(const struct dpll_pin *pin, > + void *pin_priv, > + const struct dpll_device *dpll, > + void *dpll_priv, u64 frequency, > + struct netlink_ext_ack *extack) > +{ > + struct ptp_ocp_sma_connector *sma = pin_priv; > + struct ptp_ocp *bp = dpll_priv; > + const struct ocp_selector *tbl; > + int sma_nr = (sma - bp->sma); > + int val, i; > + > + if (sma->fixed_fcn) > + return -EOPNOTSUPP; > + > + tbl = bp->sma_op->tbl[sma->mode]; > + for (i = 0; tbl[i].name; i++) > + if (tbl[i].frequency == frequency) > + return ptp_ocp_sma_store_val(bp, val, sma->mode, sma_nr); val appears to be used uninitialised here. As flagged by clang-16 W=1, and Smatch. > + return -EINVAL; > +} ... > @@ -4233,8 +4437,40 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) > > ptp_ocp_info(bp); > devlink_register(devlink); > - return 0; > > + clkid = pci_get_dsn(pdev); > + bp->dpll = dpll_device_get(clkid, 0, THIS_MODULE); > + if (IS_ERR(bp->dpll)) { > + dev_err(&pdev->dev, "dpll_device_alloc failed\n"); > + goto out; > + } > + > + err = dpll_device_register(bp->dpll, DPLL_TYPE_PPS, &dpll_ops, bp); > + if (err) > + goto out; > + > + for (i = 0; i < OCP_SMA_NUM; i++) { > + bp->sma[i].dpll_pin = dpll_pin_get(clkid, i, THIS_MODULE, &bp->sma[i].dpll_prop); > + if (IS_ERR(bp->sma[i].dpll_pin)) The function will return err. Should it be sett to an error value here? As flagged by Smatch. > + goto out_dpll; > + > + err = dpll_pin_register(bp->dpll, bp->sma[i].dpll_pin, &dpll_pins_ops, > + &bp->sma[i]); > + if (err) { > + dpll_pin_put(bp->sma[i].dpll_pin); > + goto out_dpll; > + } > + } > + queue_delayed_work(system_power_efficient_wq, &bp->sync_work, HZ); > + > + return 0; > +out_dpll: > + while (i) { > + --i; > + dpll_pin_unregister(bp->dpll, bp->sma[i].dpll_pin, &dpll_pins_ops, &bp->sma[i]); > + dpll_pin_put(bp->sma[i].dpll_pin); > + } > + dpll_device_put(bp->dpll); > out: > ptp_ocp_detach(bp); > out_disable: ... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel