Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4725944yba; Mon, 20 May 2019 02:40:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAEOd3UM0oXx4vZJCDnXLIZy0B19YvgK+5Hpk7JrzfismJW7VgsU0WGtyi8XKKVC/DDRFK X-Received: by 2002:a17:902:9a46:: with SMTP id x6mr13845265plv.118.1558345200989; Mon, 20 May 2019 02:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558345200; cv=none; d=google.com; s=arc-20160816; b=wDZ8BRpAv+tL3pgwAhyYfhtAna4c8+l9cuwq9e/Jum8t3BunergINhe5J/1D/gAWBL KuVRGSfBooY7vgTN2OJN1Yo1Lu1sYm7dHQi4s3EVmcsNeYeX7jK5fzh4Z4LxONsUet9Y ey5I4HsL8nL1OKZkaVBSEE2UQedvMfSIfG9QBUVKdx9mfI5v2DhLM/kynRdSio/qc0pc M9ky3aIQ5W6aAEPUWCFuniUWw/iq6gUoFxAn6oI8jcPpRv6PIXfbUqK5eA2pFb4FkHsA fvq9c69KLAVmfOQXhDZ1P5OLrLniTyhiZkYyHWVM1oeZAiTnKVVK/9nPwblhBRPS7w2m SZwg== 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=UtvBX5vWjTBJddAA88NUJI2WuHywQTPQ4vzIL5QqAvg=; b=Ij1AnK/P0vsahxhGyqMuC9E0rZG+WmjfZhnScjpckQm85Lwl1Nwsdo0y1hM7YLypFA BqIRUuK0WR9IZyaj0oNS2IgDm/nXvPVeh26tI9nQ9RxUkzvbHhELtBMVLdTCeagJHDMa 3XfLruWYO8IJpLw5/yzAlm0AuEtMQ1qAzPyTamR8Cp5wLIECxoEbxuHvusREkccU2dnj vF4loIWAOir/5DNjBZ9D98x4ehWE2iXXIw43JHqSvU1VwBUPcqFRggpcgjkqfDFyQ2yn QwseQ3xjBT+Z9/SggjvWuJoXcyUgt5Ma3NtnRBqoezo5ZA8dIZlT0Ggq6W7CJ4S/VVQo WQug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HJuDNJ69; 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 z19si18091948pgi.180.2019.05.20.02.39.46; Mon, 20 May 2019 02:40:00 -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=HJuDNJ69; 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 S1730479AbfETIHc (ORCPT + 99 others); Mon, 20 May 2019 04:07:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:36248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730649AbfETIFf (ORCPT ); Mon, 20 May 2019 04:05:35 -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 BD2A320862; Mon, 20 May 2019 08:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558339534; bh=vDLQsD2B5mKgg/9AQ94YonY87MdfYhRV3o85LNhdwaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HJuDNJ69iFBxjhRIg6uFFFy37jUgmClEn9Bsh6rx5GBRiCi8dFoIsntl5w2gysoac tsFAJ2b7dRlAwkFZefoyRVWM2RV6Fdxi6+NZQ+cz8NJpBswUVPo1J9oNofZ8Ni84Mg Rk5CsVk6X+Ze4QnKROEdeHLTcSAErvNKvLssEGyk= Received: by wens.tw (Postfix, from userid 1000) id 413565FD5D; Mon, 20 May 2019 16:05:32 +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 Subject: [PATCH 02/25] clk: Add CLK_HW_INIT_* macros using .parent_hws Date: Mon, 20 May 2019 16:03:58 +0800 Message-Id: <20190520080421.12575-3-wens@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520080421.12575-1-wens@kernel.org> References: <20190520080421.12575-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, struct clk_init_data was expanded to include .parent_hws, for clk drivers to directly list parents by pointing to their respective struct clk_hw's. Add macros that can take either one single struct clk_hw *, or an array of them, for drivers to use. A special CLK_HW_INIT_HWS macro is included, which takes an array of struct clk_hw *, but sets .num_parents to 1. This variant is to allow the reuse of the array, instead of having a compound literal allocated for each clk sharing the same parent. Signed-off-by: Chen-Yu Tsai --- include/linux/clk-provider.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index bb6118f79784..0c241b43a802 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -904,6 +904,24 @@ extern struct of_device_id __clk_of_table; .ops = _ops, \ }) +#define CLK_HW_INIT_HW(_name, _parent, _ops, _flags) \ + (&(struct clk_init_data) { \ + .flags = _flags, \ + .name = _name, \ + .parent_hws = (const struct clk_hw*[]) { _parent }, \ + .num_parents = 1, \ + .ops = _ops, \ + }) + +#define CLK_HW_INIT_HWS(_name, _parent, _ops, _flags) \ + (&(struct clk_init_data) { \ + .flags = _flags, \ + .name = _name, \ + .parent_hws = _parent, \ + .num_parents = 1, \ + .ops = _ops, \ + }) + #define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \ (&(struct clk_init_data) { \ .flags = _flags, \ @@ -913,6 +931,15 @@ extern struct of_device_id __clk_of_table; .ops = _ops, \ }) +#define CLK_HW_INIT_PARENTS_HW(_name, _parents, _ops, _flags) \ + (&(struct clk_init_data) { \ + .flags = _flags, \ + .name = _name, \ + .parent_hws = _parents, \ + .num_parents = ARRAY_SIZE(_parents), \ + .ops = _ops, \ + }) + #define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags) \ (&(struct clk_init_data) { \ .flags = _flags, \ -- 2.20.1