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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2992C71153 for ; Thu, 24 Aug 2023 16:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242675AbjHXQpe (ORCPT ); Thu, 24 Aug 2023 12:45:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242436AbjHXQpF (ORCPT ); Thu, 24 Aug 2023 12:45:05 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66374198; Thu, 24 Aug 2023 09:45:01 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id C1707E0004; Thu, 24 Aug 2023 16:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1692895499; 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=sgKRd8PXna9jddAQ7rYYlYUO4KIn7jskOvosbl+/UOs=; b=KTVnzD5eVG2mw9j6CEqcZhnTJSoCHDBkb/MYYvlHhrk7z6MfEr8ZRX0TSl957if3mHmwzS 6frES6KAXz+WuMYXmtFLD13OjX3VJcXVNJNMy7D6DCPoRgPj1bT8AtppiE+olPLBuMGg// JxxP0rArWBg88Nbj10QQwE39F6YhX3z3MDZGAnJf48nbqoGxGXN8Xia5wJbKAGfZBJ+N6Q HZA6C5qZftnN7pcS/5UaU+tLfQg+VnUhV0Zik7VF4qhFoxdGtvxD+UIMBMYu3kVD898JBR BQPsXzVrFkC3MWJPlEnpAEFtwQr2EIdoqd1el7kRXYhmwqMBOoOEs+RVJBd09g== Date: Thu, 24 Aug 2023 18:44:54 +0200 From: Herve Codina To: Simon Horman Cc: Christophe Leroy , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Linus Walleij , Qiang Zhao , Li Yang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Randy Dunlap , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org, Thomas Petazzoni Subject: Re: [PATCH v4 21/28] net: wan: Add framer framework support Message-ID: <20230824184454.2a96b6fc@bootlin.com> In-Reply-To: References: <5f671caf19be0a9bb7ea7b96a6c86381e243ca4c.1692376361.git.christophe.leroy@csgroup.eu> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Simon, On Sun, 20 Aug 2023 19:15:11 +0200 Simon Horman wrote: > On Fri, Aug 18, 2023 at 06:39:15PM +0200, Christophe Leroy wrote: > > From: Herve Codina > > > > A framer is a component in charge of an E1/T1 line interface. > > Connected usually to a TDM bus, it converts TDM frames to/from E1/T1 > > frames. It also provides information related to the E1/T1 line. > > > > The framer framework provides a set of APIs for the framer drivers > > (framer provider) to create/destroy a framer and APIs for the framer > > users (framer consumer) to obtain a reference to the framer, and > > use the framer. > > > > This basic implementation provides a framer abstraction for: > > - power on/off the framer > > - get the framer status (line state) > > - be notified on framer status changes > > - get/set the framer configuration > > > > Signed-off-by: Herve Codina > > Reviewed-by: Christophe Leroy > > Signed-off-by: Christophe Leroy > > Hi Christophe and Herve, > > some minor feedback from my side. > > ... > > > diff --git a/drivers/net/wan/framer/framer-core.c b/drivers/net/wan/framer/framer-core.c > > ... > > > +/** > > + * framer_create() - create a new framer > > + * @dev: device that is creating the new framer > > + * @node: device node of the framer. default to dev->of_node. > > + * @ops: function pointers for performing framer operations > > + * > > + * Called to create a framer using framer framework. > > + */ > > +struct framer *framer_create(struct device *dev, struct device_node *node, > > + const struct framer_ops *ops) > > +{ > > + int ret; > > + int id; > > + struct framer *framer; > > Please arrange local variable declarations for Networking code > using reverse xmas tree order - longest line to shortest. Yes, will be done in the next iteration. > > https://github.com/ecree-solarflare/xmastree is helpful here. > > ... > > > diff --git a/include/linux/framer/framer-provider.h b/include/linux/framer/framer-provider.h > > ... > > > +/** > > + * struct framer_ops - set of function pointers for performing framer operations > > + * @init: operation to be performed for initializing the framer > > + * @exit: operation to be performed while exiting > > + * @power_on: powering on the framer > > + * @power_off: powering off the framer > > + * @flags: OR-ed flags (FRAMER_FLAG_*) to ask for core functionality > > + * - @FRAMER_FLAG_POLL_STATUS: > > + * Ask the core to perfom a polling to get the framer status and > > nit: perfom -> perform Will be fixed in the next iteration. > > checkpatch.pl --codespell is your friend here > > > + * notify consumers on change. > > + * The framer should call @framer_notify_status_change() when it > > + * detects a status change. This is usally done using interrutps. > > nit: usally -> usually > interrutps -> interrupts Will be fixed in the next iteration. > > ... > > > diff --git a/include/linux/framer/framer.h b/include/linux/framer/framer.h > > new file mode 100644 > > index 000000000000..0bee7135142f > > --- /dev/null > > +++ b/include/linux/framer/framer.h > > @@ -0,0 +1,199 @@ > > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > > +/* > > + * Generic framer header file > > + * > > + * Copyright 2023 CS GROUP France > > + * > > + * Author: Herve Codina > > + */ > > + > > +#ifndef __DRIVERS_FRAMER_H > > +#define __DRIVERS_FRAMER_H > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/** > > + * enum framer_iface - Framer interface > > As this is a kernel-doc, please include documentation for > the defined constants: FRAMER_IFACE_E1 and FRAMER_IFACE_T1. > > As flagged by: ./scripts/kernel-doc -none Will be done in the next iteration. > > > + */ > > +enum framer_iface { > > + FRAMER_IFACE_E1, /* E1 interface */ > > + FRAMER_IFACE_T1, /* T1 interface */ > > +}; > > + > > +/** > > + * enum framer_clock_mode - Framer clock mode > > Likewise here too. > > Also, nit: framer_clock_mode -> framer_clock_type > Will be updated (doc and change to framer_clock_type) in the next iteration. > > + */ > > +enum framer_clock_type { > > + FRAMER_CLOCK_EXT, /* External clock */ > > + FRAMER_CLOCK_INT, /* Internal clock */ > > +}; > > + > > +/** > > + * struct framer_configuration - Framer configuration > > nit: framer_configuration -> framer_config Will be fixed in the next iteration. > > > + * @line_iface: Framer line interface > > + * @clock_mode: Framer clock type > > + * @clock_rate: Framer clock rate > > + */ > > +struct framer_config { > > + enum framer_iface iface; > > + enum framer_clock_type clock_type; > > + unsigned long line_clock_rate; > > +}; > > + > > +/** > > + * struct framer_status - Framer status > > + * @link_is_on: Framer link state. true, the link is on, false, the link is off. > > + */ > > +struct framer_status { > > + bool link_is_on; > > +}; > > + > > +/** > > + * framer_event - event available for notification > > nit: framer_event -> enum framer_event Will be fixed in the next iteration. > > A~d please document FRAMER_EVENT_STATUS in the kernel doc too. Will be documented in the next iteration. > > > + */ > > +enum framer_event { > > + FRAMER_EVENT_STATUS, /* Event notified on framer_status changes */ > > +}; > > ... Thanks for the review, Best regards, Hervé