From patchwork Wed Jun 16 17:03:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 461463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9AAEC49EA2 for ; Wed, 16 Jun 2021 17:03:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9A816109D for ; Wed, 16 Jun 2021 17:03:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231207AbhFPRFt (ORCPT ); Wed, 16 Jun 2021 13:05:49 -0400 Received: from mga02.intel.com ([134.134.136.20]:16774 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbhFPRFn (ORCPT ); Wed, 16 Jun 2021 13:05:43 -0400 IronPort-SDR: 8/mvV6td6JXY8OBcDGCsgBK2M0kqdJuq7fcZtWgyruD+1SOvYl0EHO2sDEw3sPjHrm+13dAonq FwwvwsY1JN2g== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="193340170" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193340170" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 10:03:34 -0700 IronPort-SDR: 5mpxZZ83PgRKTg1E5w3hlsFbLkQjxMEmtZbAhtpuso5B+naWrqyYgNyNJPgTyIEg6x1RHy8PH0 7k17hrxztmdQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="404638841" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 16 Jun 2021 10:03:30 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 354D6431; Wed, 16 Jun 2021 20:03:54 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Jonathan Corbet , "Rafael J. Wysocki" , Len Brown Subject: [PATCH v1 3/7] ACPI: sysfs: Unify pattern of memory allocations Date: Wed, 16 Jun 2021 20:03:34 +0300 Message-Id: <20210616170338.23057-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210616170338.23057-1-andriy.shevchenko@linux.intel.com> References: <20210616170338.23057-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Use the form of foo = kmalloc(sizeof(*foo)) everywhere in order to unify pattern of memory allocations. Signed-off-by: Andy Shevchenko --- drivers/acpi/sysfs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 44e50c36e70a..efb8c2dfa9cb 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -388,8 +388,7 @@ acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context) switch (event) { case ACPI_TABLE_EVENT_INSTALL: - table_attr = - kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); + table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL); if (!table_attr) return AE_NO_MEMORY; @@ -846,13 +845,11 @@ void acpi_irq_stats_init(void) num_gpes = acpi_current_gpe_count; num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; - all_attrs = kcalloc(num_counters + 1, sizeof(struct attribute *), - GFP_KERNEL); + all_attrs = kcalloc(num_counters + 1, sizeof(*all_attrs), GFP_KERNEL); if (all_attrs == NULL) return; - all_counters = kcalloc(num_counters, sizeof(struct event_counter), - GFP_KERNEL); + all_counters = kcalloc(num_counters, sizeof(*all_counters), GFP_KERNEL); if (all_counters == NULL) goto fail; @@ -860,8 +857,7 @@ void acpi_irq_stats_init(void) if (ACPI_FAILURE(status)) goto fail; - counter_attrs = kcalloc(num_counters, sizeof(struct kobj_attribute), - GFP_KERNEL); + counter_attrs = kcalloc(num_counters, sizeof(*counter_attrs), GFP_KERNEL); if (counter_attrs == NULL) goto fail; From patchwork Wed Jun 16 17:03:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 461465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DA8EC49EA2 for ; Wed, 16 Jun 2021 17:03:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68706613BD for ; Wed, 16 Jun 2021 17:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230393AbhFPRFl (ORCPT ); Wed, 16 Jun 2021 13:05:41 -0400 Received: from mga17.intel.com ([192.55.52.151]:36038 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbhFPRFl (ORCPT ); Wed, 16 Jun 2021 13:05:41 -0400 IronPort-SDR: Ue6br+JenzEDpsF/bDzszt7OYmC/bql69gBygdJrJpcv7fEL8pZWjREN6yUzPTbmKc2ZZnNBgN 63NiF38n5B5Q== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="186595887" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="186595887" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 10:03:32 -0700 IronPort-SDR: 3MBqYwvAMaTb3vMfR2V0+pqHDukKnKrJl+zaQYzza/0CZ00jJJ82fMHaVZ6bekW9mm9Ex3romh MoBp43QogE9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="640070353" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 16 Jun 2021 10:03:30 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5761C580; Wed, 16 Jun 2021 20:03:54 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Jonathan Corbet , "Rafael J. Wysocki" , Len Brown Subject: [PATCH v1 6/7] ACPI: sysfs: Remove tailing return statement in void functions Date: Wed, 16 Jun 2021 20:03:37 +0300 Message-Id: <20210616170338.23057-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210616170338.23057-1-andriy.shevchenko@linux.intel.com> References: <20210616170338.23057-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The tail return statement is redundant in void functions. Remove it. Signed-off-by: Andy Shevchenko --- drivers/acpi/sysfs.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 231aaa8b6c2c..5474563d72b8 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -577,8 +577,6 @@ static void delete_gpe_attr_array(void) kfree(counter_attrs); } kfree(all_attrs); - - return; } static void gpe_count(u32 gpe_number) @@ -593,8 +591,6 @@ static void gpe_count(u32 gpe_number) else all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR].count++; - - return; } static void fixed_event_count(u32 event_number) @@ -607,8 +603,6 @@ static void fixed_event_count(u32 event_number) else all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR].count++; - - return; } static void acpi_global_event_handler(u32 event_type, acpi_handle device, @@ -903,7 +897,6 @@ void acpi_irq_stats_init(void) fail: delete_gpe_attr_array(); - return; } static void __exit interrupt_stats_exit(void) @@ -911,8 +904,6 @@ static void __exit interrupt_stats_exit(void) sysfs_remove_group(acpi_kobj, &interrupt_stats_attr_group); delete_gpe_attr_array(); - - return; } static ssize_t pm_profile_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) From patchwork Wed Jun 16 17:03:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 461464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6209C49EA5 for ; Wed, 16 Jun 2021 17:03:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3620613BD for ; Wed, 16 Jun 2021 17:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230473AbhFPRFn (ORCPT ); Wed, 16 Jun 2021 13:05:43 -0400 Received: from mga06.intel.com ([134.134.136.31]:61468 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230167AbhFPRFl (ORCPT ); Wed, 16 Jun 2021 13:05:41 -0400 IronPort-SDR: WOjpzz011ZUgdnVaglVipYfrqcpYllI1OhzwsoOGBZq/DATe1ZNENHKhAq+JGW0vzBrSWTU82u jFrSUK3zmdJQ== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="267367479" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="267367479" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 10:03:32 -0700 IronPort-SDR: XPa3QheejKa7cc5DroKsDdKOQzb6e5GcdrWa/7Nw1E7w3oneN5/z3JzuFUTT5/e4kl+sQz/oRI qMxsoU1n7yLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="488260773" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 16 Jun 2021 10:03:30 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 622365B5; Wed, 16 Jun 2021 20:03:54 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Jonathan Corbet , "Rafael J. Wysocki" , Len Brown Subject: [PATCH v1 7/7] ACPI: sysfs: Sort headers alphabetically Date: Wed, 16 Jun 2021 20:03:38 +0300 Message-Id: <20210616170338.23057-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210616170338.23057-1-andriy.shevchenko@linux.intel.com> References: <20210616170338.23057-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org For the sake of better maintenance, sort included headers alphabetically. Signed-off-by: Andy Shevchenko --- drivers/acpi/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 5474563d72b8..00c0ebaab29f 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -5,11 +5,11 @@ #define pr_fmt(fmt) "ACPI: " fmt +#include #include #include #include #include -#include #include "internal.h"