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 4B8A3C433F5 for ; Mon, 10 Oct 2022 09:47:04 +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=1Q9R18x4Izn2mFM4Fn393/HgHDcUVG45eNhn9NFYTbw=; b=Ujd4p3Zz/cAYF6 BDEsiVJi0YGuNQ2pXkf56kvoEj6Na87Op8HtyEvzeJh0KOl3eMliloQNGn6PcgHcKKiCqj6tGzii5 +Lrj9LFMMPuaYxsZrcSH2ALJSnWj7rtkjXETKhDSV4J3qpb47A7Wb0Hj9li2SYaJ382eJzCKbOYqV e9l5TP3t22TITAUx2ugiAuWMuBBy/AgN5ftqyUSnR/A2irbFeAaGYIM7+UytNz3Nz0bo7SUqB92ss iIDuQGkY75x0A2B2U+R7zQx+QOy+1AX0+6ydvH9cInFxrGLp1orkpRdSY2Z0N9kIRgrLj+G+R2aDf pphtjvJ1VREUfb7egkXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohpMJ-000FP4-44; Mon, 10 Oct 2022 09:46:03 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohpMF-000FMj-PR for linux-arm-kernel@lists.infradead.org; Mon, 10 Oct 2022 09:46:01 +0000 Received: by mail-ej1-x62f.google.com with SMTP id k2so23715723ejr.2 for ; Mon, 10 Oct 2022 02:45:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20210112.gappssmtp.com; s=20210112; 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=89t0fmxpfi+MN7XN16LJF3/w509j7KVWzr+Dzj8Jcuc=; b=AcjFjUydLE2BB5dua8a+501YZkeQSpKUZz++OFFWcHGewQ7pFTF4rikBqwFDn6burL 6WS4avnhXNkBmOKRYXAi84tzP4wtslXV2nyd0l7xVnVb/oKzSlWgYrMpDGx/tizwND3V 5zyB8bFOASZreloGFW3PVFlwEWUGP4+U+o+RQNMjidw8+1tBHLgywdVoK6aWA9zzUZgs Drgf9O52g4eQX2MuyvPb5O3t5K5kM1JB68O5USyHE9Ni0B52hc6e7sw0a+wMUA0jyDeK xiY1KX0lqN0WAZqqn0XCmUQzlzPOb74vVMoTZChmajZcJStKpqf/gYSXL3+gdR91HC4B 1a6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=89t0fmxpfi+MN7XN16LJF3/w509j7KVWzr+Dzj8Jcuc=; b=p0LRLYhJ3ub04Y3w+JoauWwJU0bRP+ucMPB4yQWMhcBNjFpEbt8r6Jxeqi/jYARFMT sfMtarIK3D5c1pS55GiFWlNUZQWWaznpNbFFnQHKWakj/nbyGQvRqzTEQDb/C69MuJhs g3a1sPsRF3Yqra6g2jjrKh9dxcfnyetcKypXycd/Ppj52WcRLSP9/gqyJCIfOCUl9Lhb r9/kT9CPeXCfTXR8lOov8sCgLgOaqDk5m6oSzSlmq5Jzb/EvRvTxvdY5XpC7HhsHJ3Xx /ZULn2Z3VKe7BQoO+xHmefr/V8UbnT8U8hSoxEvyZ5RX+UaMRdZxnfmtfTPC2lBwpiJX FeVw== X-Gm-Message-State: ACrzQf30V9FQuXNF5DyYXIH4k/N0zdZfN0LzP/6mY110QJ2WMaj3yHC/ ePTkRUITvVtxM7v6pILLEZFVFA== X-Google-Smtp-Source: AMsMyM4Frup54P7KdL89txKbMCsbWlnlbp00icN0GyXCiI33uNDIo6cnLF5Wg5jt6sUthwz1GmX0pQ== X-Received: by 2002:a17:907:2723:b0:78d:95d3:47aa with SMTP id d3-20020a170907272300b0078d95d347aamr8440690ejl.367.1665395157487; Mon, 10 Oct 2022 02:45:57 -0700 (PDT) Received: from localhost (host-213-179-129-39.customer.m-online.net. [213.179.129.39]) by smtp.gmail.com with ESMTPSA id j24-20020a17090643d800b0078d2a2ca930sm5047966ejn.85.2022.10.10.02.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 02:45:56 -0700 (PDT) Date: Mon, 10 Oct 2022 11:45:55 +0200 From: Jiri Pirko To: Vadim Fedorenko Cc: Jakub Kicinski , Arkadiusz Kubalewski , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Vadim Fedorenko Subject: Re: [RFC PATCH v3 4/6] dpll: get source/output name Message-ID: References: <20221010011804.23716-1-vfedorenko@novek.ru> <20221010011804.23716-5-vfedorenko@novek.ru> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221010011804.23716-5-vfedorenko@novek.ru> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221010_024559_856145_2C4E0643 X-CRM114-Status: GOOD ( 14.95 ) 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 Mon, Oct 10, 2022 at 03:18:02AM CEST, vfedorenko@novek.ru wrote: >From: Arkadiusz Kubalewski > >Dump names of sources and outputs in response to DPLL_CMD_DEVICE_GET dump >request. > >Signed-off-by: Arkadiusz Kubalewski >--- > drivers/dpll/dpll_netlink.c | 24 ++++++++++++++++++++++++ > include/linux/dpll.h | 2 ++ > include/uapi/linux/dpll.h | 2 ++ > 3 files changed, 28 insertions(+) > >diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c >index a5779871537a..e3604c10b59e 100644 >--- a/drivers/dpll/dpll_netlink.c >+++ b/drivers/dpll/dpll_netlink.c >@@ -31,12 +31,16 @@ static const struct nla_policy dpll_genl_set_source_policy[] = { > [DPLLA_DEVICE_ID] = { .type = NLA_U32 }, > [DPLLA_SOURCE_ID] = { .type = NLA_U32 }, > [DPLLA_SOURCE_TYPE] = { .type = NLA_U32 }, >+ [DPLLA_SOURCE_NAME] = { .type = NLA_STRING, >+ .len = DPLL_NAME_LENGTH }, > }; > > static const struct nla_policy dpll_genl_set_output_policy[] = { > [DPLLA_DEVICE_ID] = { .type = NLA_U32 }, > [DPLLA_OUTPUT_ID] = { .type = NLA_U32 }, > [DPLLA_OUTPUT_TYPE] = { .type = NLA_U32 }, >+ [DPLLA_OUTPUT_NAME] = { .type = NLA_STRING, >+ .len = DPLL_NAME_LENGTH }, > }; > > static const struct nla_policy dpll_genl_set_src_select_mode_policy[] = { >@@ -100,6 +104,7 @@ static int __dpll_cmd_dump_sources(struct dpll_device *dpll, > { > int i, ret = 0, type, prio; > struct nlattr *src_attr; >+ const char *name; > > for (i = 0; i < dpll->sources_count; i++) { > src_attr = nla_nest_start(msg, DPLLA_SOURCE); >@@ -132,6 +137,15 @@ static int __dpll_cmd_dump_sources(struct dpll_device *dpll, > break; > } > } >+ if (dpll->ops->get_source_name) { >+ name = dpll->ops->get_source_name(dpll, i); >+ if (name && nla_put_string(msg, DPLLA_SOURCE_NAME, >+ name)) { >+ nla_nest_cancel(msg, src_attr); >+ ret = -EMSGSIZE; >+ break; >+ } >+ } > nla_nest_end(msg, src_attr); > } > >@@ -143,6 +157,7 @@ static int __dpll_cmd_dump_outputs(struct dpll_device *dpll, > { > struct nlattr *out_attr; > int i, ret = 0, type; >+ const char *name; > > for (i = 0; i < dpll->outputs_count; i++) { > out_attr = nla_nest_start(msg, DPLLA_OUTPUT); >@@ -167,6 +182,15 @@ static int __dpll_cmd_dump_outputs(struct dpll_device *dpll, > } > ret = 0; > } >+ if (dpll->ops->get_output_name) { >+ name = dpll->ops->get_output_name(dpll, i); >+ if (name && nla_put_string(msg, DPLLA_OUTPUT_NAME, >+ name)) { >+ nla_nest_cancel(msg, out_attr); >+ ret = -EMSGSIZE; >+ break; >+ } >+ } > nla_nest_end(msg, out_attr); > } > >diff --git a/include/linux/dpll.h b/include/linux/dpll.h >index 3fe957a06b90..2f4964dc28f0 100644 >--- a/include/linux/dpll.h >+++ b/include/linux/dpll.h >@@ -23,6 +23,8 @@ struct dpll_device_ops { > int (*set_output_type)(struct dpll_device *dpll, int id, int val); > int (*set_source_select_mode)(struct dpll_device *dpll, int mode); > int (*set_source_prio)(struct dpll_device *dpll, int id, int prio); >+ const char *(*get_source_name)(struct dpll_device *dpll, int id); >+ const char *(*get_output_name)(struct dpll_device *dpll, int id); Hmm, why you exactly need the name for? > }; > > struct dpll_device *dpll_device_alloc(struct dpll_device_ops *ops, const char *name, >diff --git a/include/uapi/linux/dpll.h b/include/uapi/linux/dpll.h >index f6b674e5cf01..8782d3425aae 100644 >--- a/include/uapi/linux/dpll.h >+++ b/include/uapi/linux/dpll.h >@@ -26,11 +26,13 @@ enum dpll_genl_attr { > DPLLA_SOURCE, > DPLLA_SOURCE_ID, > DPLLA_SOURCE_TYPE, >+ DPLLA_SOURCE_NAME, > DPLLA_SOURCE_SUPPORTED, > DPLLA_SOURCE_PRIO, > DPLLA_OUTPUT, > DPLLA_OUTPUT_ID, > DPLLA_OUTPUT_TYPE, >+ DPLLA_OUTPUT_NAME, > DPLLA_OUTPUT_SUPPORTED, > DPLLA_STATUS, > DPLLA_TEMP, >-- >2.27.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel