Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4237254ybi; Tue, 11 Jun 2019 03:20:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9rD1BeaOqowURkOTUEjwQq93WUFIq325HB2Rg0gP/V8xn0Wl7CF7n0XDEaPkxBD1urG6k X-Received: by 2002:a17:90a:db52:: with SMTP id u18mr10285535pjx.107.1560248429779; Tue, 11 Jun 2019 03:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560248429; cv=none; d=google.com; s=arc-20160816; b=wD7A//XM0wvK0AZEbNTJtJ9LiwZPBM4UB6Q6CMixFbTwfJtNkqagTrUvTJrKRbEWoB TkMnMtWUvorYsgLn+qCGpFqU3yVrYt9+civG53nEma9SfkU/CWzgq0kDLqffK6JzoadV hUU1KP9/r30cUBwr7PQdKI/Ssgb7jPXfeji0K4RT/S/VVdWrB+H8QElEGCNhBx4od+ia caXEDJw7AcmL6ODY0MVXgHxRkAgYbo1flbYcXnbl/88gB/OWxfdB1h9VV4Lgo4OKZJPk r9xp4N9goTCtdlqhr7dtna2ZA+538wRNXGPu6w9AEumj/iOzEDuANmXqcVp0W3LEgyuR raeQ== 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=tUZ87TTIeJPk3yH72rmMYEGw2HVVEkzFhDHgzaFd5uA=; b=TgU7JQpv955RdYtCkKt2PwMNGSJIG0v6qmH0s0uK6hkrV5y/ldkz2AdBhRr9IkuqWG NXO8EosjORVYuzWUxc66KkANs1pugv1Omxuk23Q7zplHZWFItxyVGFDLxfk1TlOYWejQ iecUy+4nwkKjAXA7Knl3colHpYmT01XDJCtCnZ5kQ0LtPapmZKcqywePg3K7ZLEMFuJO SvPUEMPAAAQn99R2wuGkcONpFA060bcgyA3ULYSwu2Ea5yrmy4LtX4Hypx+vqtBc0tZv b1S9HRMmk1AEGqJhAMrs5B9AweAzIchsDOfmhZXgDrOlcM5fVbItsCStXEsQEurDwkD1 JLSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wQYoJEDm; 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 j25si12652220pfr.146.2019.06.11.03.20.14; Tue, 11 Jun 2019 03:20:29 -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=wQYoJEDm; 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 S2405293AbfFKKRW (ORCPT + 99 others); Tue, 11 Jun 2019 06:17:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:45540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405038AbfFKKRV (ORCPT ); Tue, 11 Jun 2019 06:17:21 -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 121C8212F5; Tue, 11 Jun 2019 10:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560248241; bh=uAVNKwQsk008WMN9I4bdYYLY9j8+uUFL/Mq3nvXQu1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wQYoJEDm6ZJ8bMcz+vCo/iiV6bx2Ro5ZSfz/GPXanc9zscMEubXZd6D7REBTi0l9J AvEf/8g1PHEnv974piDwhvmHKSRXS2Xlo2WVzVdDUqPdexkxhcv3lhqVaqBbPnD3oB GRBzyiEn7cH8vNvFTUbxudmsfjopqV/+uBk0ODy0= Received: by wens.tw (Postfix, from userid 1000) id 1871B60039; 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 02/25] clk: Add CLK_HW_INIT_* macros using .parent_hws Date: Tue, 11 Jun 2019 18:16:35 +0800 Message-Id: <20190611101658.23855-3-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, 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 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index bb6118f79784..70aad5cefea7 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -904,6 +904,29 @@ 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, \ + }) + +/* + * This macro is intended for drivers to be able to share the otherwise + * individual struct clk_hw[] compound literals created by the compiler + * when using CLK_HW_INIT_HW. It does NOT support multiple parents. + */ +#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 +936,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