From patchwork Fri Nov 11 15:46:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 624455 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F23CC433FE for ; Fri, 11 Nov 2022 15:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234045AbiKKPqF (ORCPT ); Fri, 11 Nov 2022 10:46:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233923AbiKKPqE (ORCPT ); Fri, 11 Nov 2022 10:46:04 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A480625C4D; Fri, 11 Nov 2022 07:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668181563; x=1699717563; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=DmQaptAdDzNbGCp3ivClJtgkBMbzP5Q4OG5xUGDVa0A=; b=Z4Gb+3im8KbmFkDdos4X2EHC1Z0os0MURDxlh+fdbYu3d9s8pftFMlza 19gEUMMzdCtrCN+e7nZ/uC2VwPX+m2jNPtyeotHigFBbWpw43PD3EwHOE dgYRrlRVKuioppTm/QkozmNw1S85ejBqMBaU76jZgFlkyuJohZlV264gO V8irFa2lx0POvvHBOy+9bYbJD8tcezsF7dRId+kUxA+yVsPQEoMd7+959 BI+WAjwSmXWN2nRo0MEbYhZrocWZjVjzTf8lGHIoaORnB4j1XVHuTX1tb pf0yhY9iVJsRp2N2hVCo6Z8NqbZVZMvp3jxDyoF/+FIGy7zAUzWOFUy9g g==; X-IronPort-AV: E=McAfee;i="6500,9779,10528"; a="309246132" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="309246132" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 07:46:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10528"; a="668843583" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="668843583" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 11 Nov 2022 07:46:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8376B155; Fri, 11 Nov 2022 17:46:24 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Scally , Heikki Krogerus , Sakari Ailus Subject: [PATCH v3 1/3] device property: Get rid of __PROPERTY_ENTRY_ARRAY_EL*SIZE*() Date: Fri, 11 Nov 2022 17:46:19 +0200 Message-Id: <20221111154621.15941-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org First of all, _ELEMENT_SIZE() repeats existing sizeof_field() macro. Second, usage of _ARRAY_ELSIZE_LEN() adds unnecessary indirection to the data layout. It's more understandable when the data structure is placed explicitly. That said, get rid of those macros by replacing them with the existing helper and explicit data structure layout. Signed-off-by: Andy Shevchenko Acked-by: Heikki Krogerus --- v3: fixed typo in PROPERTY_ENTRY_REF_ARRAY_LEN() impl (LKP) v2: rebased on latest Linux Next, fixed anon union assignment include/linux/property.h | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/include/linux/property.h b/include/linux/property.h index 5d840299146d..0eab13a5c7df 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -12,6 +12,7 @@ #include #include +#include #include struct device; @@ -311,24 +312,14 @@ struct property_entry { * crafted to avoid gcc-4.4.4's problems with initialization of anon unions * and structs. */ - -#define __PROPERTY_ENTRY_ELEMENT_SIZE(_elem_) \ - sizeof(((struct property_entry *)NULL)->value._elem_[0]) - -#define __PROPERTY_ENTRY_ARRAY_ELSIZE_LEN(_name_, _elsize_, _Type_, \ - _val_, _len_) \ -(struct property_entry) { \ - .name = _name_, \ - .length = (_len_) * (_elsize_), \ - .type = DEV_PROP_##_Type_, \ - { .pointer = _val_ }, \ +#define __PROPERTY_ENTRY_ARRAY_LEN(_name_, _elem_, _Type_, _val_, _len_) \ +(struct property_entry) { \ + .name = _name_, \ + .length = (_len_) * sizeof_field(struct property_entry, value._elem_[0]), \ + .type = DEV_PROP_##_Type_, \ + { .pointer = _val_ }, \ } -#define __PROPERTY_ENTRY_ARRAY_LEN(_name_, _elem_, _Type_, _val_, _len_)\ - __PROPERTY_ENTRY_ARRAY_ELSIZE_LEN(_name_, \ - __PROPERTY_ENTRY_ELEMENT_SIZE(_elem_), \ - _Type_, _val_, _len_) - #define PROPERTY_ENTRY_U8_ARRAY_LEN(_name_, _val_, _len_) \ __PROPERTY_ENTRY_ARRAY_LEN(_name_, u8_data, U8, _val_, _len_) #define PROPERTY_ENTRY_U16_ARRAY_LEN(_name_, _val_, _len_) \ @@ -340,9 +331,12 @@ struct property_entry { #define PROPERTY_ENTRY_STRING_ARRAY_LEN(_name_, _val_, _len_) \ __PROPERTY_ENTRY_ARRAY_LEN(_name_, str, STRING, _val_, _len_) #define PROPERTY_ENTRY_REF_ARRAY_LEN(_name_, _val_, _len_) \ - __PROPERTY_ENTRY_ARRAY_ELSIZE_LEN(_name_, \ - sizeof(struct software_node_ref_args), \ - REF, _val_, _len_) +(struct property_entry) { \ + .name = _name_, \ + .length = (_len_) * sizeof(struct software_node_ref_args), \ + .type = DEV_PROP_REF, \ + { .pointer = _val_ }, \ +} #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \ PROPERTY_ENTRY_U8_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) @@ -360,7 +354,7 @@ struct property_entry { #define __PROPERTY_ENTRY_ELEMENT(_name_, _elem_, _Type_, _val_) \ (struct property_entry) { \ .name = _name_, \ - .length = __PROPERTY_ENTRY_ELEMENT_SIZE(_elem_), \ + .length = sizeof_field(struct property_entry, value._elem_[0]), \ .is_inline = true, \ .type = DEV_PROP_##_Type_, \ { .value = { ._elem_[0] = _val_ } }, \ From patchwork Fri Nov 11 15:46:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 623834 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE453C43217 for ; Fri, 11 Nov 2022 15:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234059AbiKKPqG (ORCPT ); Fri, 11 Nov 2022 10:46:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234013AbiKKPqE (ORCPT ); Fri, 11 Nov 2022 10:46:04 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 558E22EF28; Fri, 11 Nov 2022 07:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668181564; x=1699717564; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NQU2xvwud4AEa804tDYfWy6tAxT1OjagKjYgyWpiMZQ=; b=Qow/qU7qyr5HAAw6fnAXp2/YgKbkVQ2hoW/n1GrhqFxB+K5vD+Spsy/7 8b4a+9ObQKwpFBa2BgzQuNX/eblYCUScadt1UoAkXQG1Cym3j7eO6mvdW hkPzabS731IuOtrdhlfScX74WhK2/qocaNojVGuhMdjiH7n4xHr4vkPB4 o2IEcW1mUYLgVETtYjRLAj+Nzc5DkbRrzxin6GhrbKgr7Q4rnNYQvC8aT tloi+HsXWip+oFwYv2Hj31+CVTJnPKlrYe2Lg3u6rQjFksf8mqbmyvL3+ zlgNvTNXRww4IHZn70i+KIOdhspcgD07TgKW/xvursEKLiZh5IYw1JxTI w==; X-IronPort-AV: E=McAfee;i="6500,9779,10528"; a="309246133" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="309246133" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 07:46:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10528"; a="668843585" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="668843585" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 11 Nov 2022 07:46:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 930AAB7; Fri, 11 Nov 2022 17:46:24 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Scally , Heikki Krogerus , Sakari Ailus Subject: [PATCH v3 2/3] device property: Move PROPERTY_ENTRY_BOOL() a bit down Date: Fri, 11 Nov 2022 17:46:20 +0200 Message-Id: <20221111154621.15941-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221111154621.15941-1-andriy.shevchenko@linux.intel.com> References: <20221111154621.15941-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Let's order ARRAY and non-ARRAY macros in the same way. The PROPERTY_ENTRY_BOOL() is special, move it a bit down in the code so it won't break ordering of the rest. Signed-off-by: Andy Shevchenko --- v3: no changes v2: rebased on latest Linux Next include/linux/property.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/property.h b/include/linux/property.h index 0eab13a5c7df..8b4d2d9deea5 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -330,6 +330,7 @@ struct property_entry { __PROPERTY_ENTRY_ARRAY_LEN(_name_, u64_data, U64, _val_, _len_) #define PROPERTY_ENTRY_STRING_ARRAY_LEN(_name_, _val_, _len_) \ __PROPERTY_ENTRY_ARRAY_LEN(_name_, str, STRING, _val_, _len_) + #define PROPERTY_ENTRY_REF_ARRAY_LEN(_name_, _val_, _len_) \ (struct property_entry) { \ .name = _name_, \ @@ -371,12 +372,6 @@ struct property_entry { #define PROPERTY_ENTRY_STRING(_name_, _val_) \ __PROPERTY_ENTRY_ELEMENT(_name_, str, STRING, _val_) -#define PROPERTY_ENTRY_BOOL(_name_) \ -(struct property_entry) { \ - .name = _name_, \ - .is_inline = true, \ -} - #define PROPERTY_ENTRY_REF(_name_, _ref_, ...) \ (struct property_entry) { \ .name = _name_, \ @@ -385,9 +380,14 @@ struct property_entry { { .pointer = &SOFTWARE_NODE_REFERENCE(_ref_, ##__VA_ARGS__), }, \ } +#define PROPERTY_ENTRY_BOOL(_name_) \ +(struct property_entry) { \ + .name = _name_, \ + .is_inline = true, \ +} + struct property_entry * property_entries_dup(const struct property_entry *properties); - void property_entries_free(const struct property_entry *properties); bool device_dma_supported(const struct device *dev); From patchwork Fri Nov 11 15:46:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 623835 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5B39C4332F for ; Fri, 11 Nov 2022 15:46:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234029AbiKKPqE (ORCPT ); Fri, 11 Nov 2022 10:46:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233900AbiKKPqD (ORCPT ); Fri, 11 Nov 2022 10:46:03 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15BEFDE93; Fri, 11 Nov 2022 07:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668181563; x=1699717563; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s5EAnjlVfk1tGXA/lPL/gyF6PcL/A8uBGKW/S3pRYSU=; b=cdyklsZng7CyD9eoyR+Ahacul6G8INE5W6iPvkfpilZsIrdwniA2dDxN LuZFvHuqJ3cvXw94Rt9SMyHPa9aRa+FfEqKAogD21iowcIw4bHsWiPC7a zEzNrsySooE3+oLQjtgWDKuqZmlQSHnaeT8bRmJJH02dKGvKeIXSAXUo3 5eT+gvh/JnHs20xa2aTPrpAdjIRozKv3Y+YCOwaixSSSoQ1uHwt1rsvXq nlEXEL2Q3h4tq4bgXO2HJv/L1XyC8R0Xz68NvK2YtlmQEGA+GKjq+38KG zHEKsRTw4eZWPsR9JkDiA5Ph54hEejiJPuGxnVjjox/JvV8uu/fuUkuXz g==; X-IronPort-AV: E=McAfee;i="6500,9779,10528"; a="309246130" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="309246130" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 07:46:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10528"; a="668843584" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="668843584" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 11 Nov 2022 07:46:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A78B129D; Fri, 11 Nov 2022 17:46:24 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Scally , Heikki Krogerus , Sakari Ailus Subject: [PATCH v3 3/3] device property: Add a blank line in Kconfig of tests Date: Fri, 11 Nov 2022 17:46:21 +0200 Message-Id: <20221111154621.15941-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221111154621.15941-1-andriy.shevchenko@linux.intel.com> References: <20221111154621.15941-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Seems the blank line to separate entries in Kconfig was missing. Add it. Signed-off-by: Andy Shevchenko --- v3: new patch drivers/base/test/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/test/Kconfig b/drivers/base/test/Kconfig index 2f3fa31a948e..610a1ba7a467 100644 --- a/drivers/base/test/Kconfig +++ b/drivers/base/test/Kconfig @@ -8,6 +8,7 @@ config TEST_ASYNC_DRIVER_PROBE The module name will be test_async_driver_probe.ko If unsure say N. + config DRIVER_PE_KUNIT_TEST bool "KUnit Tests for property entry API" if !KUNIT_ALL_TESTS depends on KUNIT=y