From patchwork Mon Sep 17 18:16:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 970779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I3jtGw4f"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42DZ8016Hgz9s9h for ; Tue, 18 Sep 2018 04:16:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728453AbeIQXon (ORCPT ); Mon, 17 Sep 2018 19:44:43 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:38473 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727832AbeIQXom (ORCPT ); Mon, 17 Sep 2018 19:44:42 -0400 Received: by mail-pl1-f196.google.com with SMTP id u11-v6so7804279plq.5; Mon, 17 Sep 2018 11:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r8mNCJS03Mr9/67bWJUwh5jkftsqLb++Nk1K1auq53Y=; b=I3jtGw4fD0wpL80B4RZaxWxWhB5Wy9PjM5O0FPyBPWUbaXkrEHwrvss0c6BUN7FTEi /7H2MulVUabnqIX6Db9ZG6UAEv/1uxiHuA+9K7zkDDGjFPOrZUxdRk6ZCrTY0/2BgChR L1FKYI4FdrI56p5wKDbTMn5sZr6QpJJdxR/ykFQ4MRNPL0DiEFK0cQdHAnAJiW7s5NkJ 2WIMsqO7jp5AWjOxh6uyJg95GG8hihp2fZxbmIcNxyMD5jsCVUofy0JAk1VirgLaHXPu LV/+rYzOJ2Bk1siJLxAKR4T+WBoTTHcwAIw/3k1MAhYKhiAXPNcrjl9F0IdokYV1rK9P TE5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r8mNCJS03Mr9/67bWJUwh5jkftsqLb++Nk1K1auq53Y=; b=dUsRRfBaQ8bVbxFg4JpYUcunY07Zhh6CywXywvs4Kxprk74xydOqIY6bPjMesxBMkY bSua0urZ7j9WbABEVT+vWohhM23SMqsEE+9zc7N5kNB72l16kY1Gzbtib0LCUWtY9Tfl wzkM63WCaL130bM1FtXcUl2qGDMmapBbPCKx2a0MH4xnYxEEaGEC3+B/CZ2igxwVA0Ui aH5nEoHhgTqeZeUFZF6S9eyra4VXlzNkPidIjhMFXeN7dqzoE15FtaAOHVbuJQP0b5VB YskRLiu1G/kbZkxAgSWazFfjU58/0MW8H0LIalOc8SFP1txrypF5VB88xOUhB2oehzHb GaiA== X-Gm-Message-State: APzg51A0vboBTmTGQGCpeI+7jQaPlVCKMc44EO6EOxYLCCdDDTPNzDFL 50mYLl1mff3b+l7z4EKESFA= X-Google-Smtp-Source: ANB0VdYJh0/BnClHmiPjbt4L1btxq+Ee0x+g73dY8RrCJO1u+NIHJ73Laat6r1hRRQxzT0TVOCVk3g== X-Received: by 2002:a17:902:561:: with SMTP id 88-v6mr25788070plf.320.1537208172276; Mon, 17 Sep 2018 11:16:12 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id 74-v6sm24076366pfv.33.2018.09.17.11.16.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Sep 2018 11:16:10 -0700 (PDT) From: Dmitry Torokhov To: Linus Walleij , "Rafael J . Wysocki" Cc: linux-input@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [RFC/PATCH 3/5] device property: export property_set structure Date: Mon, 17 Sep 2018 11:16:01 -0700 Message-Id: <20180917181603.125492-4-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.19.0.397.gdd90340f6a-goog In-Reply-To: <20180917181603.125492-1-dmitry.torokhov@gmail.com> References: <20180917181603.125492-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Future gpiolib will need to handle property sets properly, and this we need to export property_set, is_pset_node() and to_pset_node(). Signed-off-by: Dmitry Torokhov --- drivers/base/pset_property.c | 31 ++----------------------------- include/linux/property.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/base/pset_property.c b/drivers/base/pset_property.c index 63f2377aefe8..7118528816a4 100644 --- a/drivers/base/pset_property.c +++ b/drivers/base/pset_property.c @@ -14,34 +14,6 @@ #include #include -struct property_set { - struct device *dev; - struct fwnode_handle fwnode; - const struct property_entry *properties; - - struct property_set *parent; - /* Entry in parent->children list */ - struct list_head child_node; - struct list_head children; -}; - -static const struct fwnode_operations pset_fwnode_ops; - -static inline bool is_pset_node(const struct fwnode_handle *fwnode) -{ - return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &pset_fwnode_ops; -} - -#define to_pset_node(__fwnode) \ - ({ \ - typeof(__fwnode) __to_pset_node_fwnode = __fwnode; \ - \ - is_pset_node(__to_pset_node_fwnode) ? \ - container_of(__to_pset_node_fwnode, \ - struct property_set, fwnode) : \ - NULL; \ - }) - static const struct property_entry * pset_prop_get(const struct property_set *pset, const char *name) { @@ -323,13 +295,14 @@ pset_fwnode_get_next_subnode(const struct fwnode_handle *fwnode, return &next->fwnode; } -static const struct fwnode_operations pset_fwnode_ops = { +const struct fwnode_operations pset_fwnode_ops = { .property_present = pset_fwnode_property_present, .property_read_int_array = pset_fwnode_read_int_array, .property_read_string_array = pset_fwnode_property_read_string_array, .get_parent = pset_fwnode_get_parent, .get_next_child_node = pset_fwnode_get_next_subnode, }; +EXPORT_SYMBOL_GPL(pset_fwnode_ops); static void property_entry_free_data(const struct property_entry *p) { diff --git a/include/linux/property.h b/include/linux/property.h index bb1cf4f30770..957f75d10cf9 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -13,6 +13,7 @@ #ifndef _LINUX_PROPERTY_H_ #define _LINUX_PROPERTY_H_ +#include #include #include @@ -281,6 +282,34 @@ device_add_child_properties(struct device *dev, const struct property_entry *properties); void device_remove_properties(struct device *dev); +struct property_set { + struct device *dev; + struct fwnode_handle fwnode; + const struct property_entry *properties; + + struct property_set *parent; + /* Entry in parent->children list */ + struct list_head child_node; + struct list_head children; +}; + +extern const struct fwnode_operations pset_fwnode_ops; + +static inline bool is_pset_node(const struct fwnode_handle *fwnode) +{ + return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &pset_fwnode_ops; +} + +#define to_pset_node(__fwnode) \ + ({ \ + typeof(__fwnode) __to_pset_node_fwnode = __fwnode; \ + \ + is_pset_node(__to_pset_node_fwnode) ? \ + container_of(__to_pset_node_fwnode, \ + struct property_set, fwnode) : \ + NULL; \ + }) + bool device_dma_supported(struct device *dev); enum dev_dma_attr device_get_dma_attr(struct device *dev);