Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4236295ybi; Tue, 11 Jun 2019 03:19:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzFqgOp0W02TX0+HGSdb6Z4HBZ+zLDovnrk11CSAYaKqR8WxP8GvgHywQiu1LDH/SbXFsv X-Received: by 2002:a63:de53:: with SMTP id y19mr19666856pgi.166.1560248368822; Tue, 11 Jun 2019 03:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560248368; cv=none; d=google.com; s=arc-20160816; b=XzTFmV9xPPCvP4fCaW4+Nmy4rcC1/WuGluthpKrPYzcD/mPiPz+btuUNhQ9EcoUldS x78ZylAna0dUZG2peSIrcuYKNA+n2mVvsJ026syYMeqWG86O8rxkmMUT0dPTl3oOJveq /w5YgQjzx93k6LmXBZbj/pLuIMJngscFp81kHD9cGWAT6ImQpyTxHDCHsg8kvpYwvlRt VfY2C5eICJz8x9A5V73Q2bhPW7PAsey1sXnHAI/Vbfb42td/45jM1dJH+5N+gBUhrVgd t9nnV4oVFMfG34h1kd8LomRTRoy4PdMeJps8TKL5gPbdrOJv6EQmQENyX218ICwIgaan PXwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XVqKX4BzkHChrYd/duZLU6tZFOFwlGUQA2S+7oUfoWs=; b=wnFgMg/p6Nhn8K9lhh5d9+/ismHkCfAcCMAPw/4+pRORdybI2KOh4PvpIxxXY3SZZu sBbahH3tkWCtF68ITk1yJO4oa/TZzDzmGpTxyZ1mw0sU0pzsFVaYI1uquwLC6hr6UpcP Ru3aoTF5SyybRyHvX9xo2CC6JV2KawhsxG+fs+u95V4P8/X+oZwydteZW8D4vi863O5H Xb+7CRC6Nm50wuzLpdFpRN7gFPOor82wTuWMu1VN6pRhfvgzBqMdxzIzzaho6T8xaf37 y5zqdhQn/rF1SrG4kgK32cK1lM7Se0Bexno7xzhQ9mZFhY7Xi1CgwyVRd02xkTcy8RJ1 7HuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I3WfUcUX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g16si11705827plo.211.2019.06.11.03.19.13; Tue, 11 Jun 2019 03:19:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I3WfUcUX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405573AbfFKKSm (ORCPT + 99 others); Tue, 11 Jun 2019 06:18:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:45898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405314AbfFKKRY (ORCPT ); Tue, 11 Jun 2019 06:17:24 -0400 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C2C321743; Tue, 11 Jun 2019 10:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560248243; bh=9pP3OKj38O5IkaCOSE4CREy2A/7c7sgJ1J4PosN60ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3WfUcUXiekWEAT+fNA59IZv43uoQI5NzkILbpcZcSRa1AvEEitV9A8yetlJIF8bJ X9nxNOXD66Xf4uSGP+UYZ2sFBPyFj5pe4tYyiA+AXftwlUZyi4UTxp2lph4Wx5mibv IWQ4neS/eqfTKhGPb2sm67ULS8LtIivQ8oFhUE9s= Received: by wens.tw (Postfix, from userid 1000) id 35F6F602B7; Tue, 11 Jun 2019 18:17:18 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Stephen Boyd , Michael Turquette Cc: Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH v2 06/25] clk: fixed-factor: Add CLK_FIXED_FACTOR_HWS which takes list of struct clk_hw * Date: Tue, 11 Jun 2019 18:16:39 +0800 Message-Id: <20190611101658.23855-7-wens@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611101658.23855-1-wens@kernel.org> References: <20190611101658.23855-1-wens@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai With the new clk parenting code, clk_init_data was expanded to include .parent_hws, for clk drivers to directly reference parents by clk_hw. Add a new macro, CLK_FIXED_FACTOR_HWS, that can take an array of pointers to struct clk_hw, instead of a string, as its parent. Taking an array instead of a direct pointer allows the reuse of the array for multiple clks, rather than having one compound literal with the same contents allocated for each clk declaration. Signed-off-by: Chen-Yu Tsai --- include/linux/clk-provider.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index c85e9f3809f2..146a6859969e 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -996,6 +996,21 @@ extern struct of_device_id __clk_of_table; _flags), \ } +/* + * This macro allows the driver to reuse the _parent array for multiple + * fixed factor clk declarations. + */ +#define CLK_FIXED_FACTOR_HWS(_struct, _name, _parent, \ + _div, _mult, _flags) \ + struct clk_fixed_factor _struct = { \ + .div = _div, \ + .mult = _mult, \ + .hw.init = CLK_HW_INIT_HWS(_name, \ + _parent, \ + &clk_fixed_factor_ops, \ + _flags), \ + } + #ifdef CONFIG_OF int of_clk_add_provider(struct device_node *np, struct clk *(*clk_src_get)(struct of_phandle_args *args, -- 2.20.1