From patchwork Wed Aug 31 14:03:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 601467 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 34B4EECAAD4 for ; Wed, 31 Aug 2022 14:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231421AbiHaODQ (ORCPT ); Wed, 31 Aug 2022 10:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbiHaODQ (ORCPT ); Wed, 31 Aug 2022 10:03:16 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFA80D5EB8; Wed, 31 Aug 2022 07:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661954595; x=1693490595; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=RbY/aWnpX9nBBwm/4aR1TT5UBpgs0Ub5zqkXni9Jkno=; b=C+hhsvwgk+cvEYSxGuf9X3jSov0NpC8Pyc8DMwiy+lcL5MUEtqjKtQlI 3X0hvDdL2GGQTKLpq0mlaMdcHddGV58vxkkhTVi1XLYhKKViqSR3T9f7K ssaTQu1Q6RkoGBJHUB4wiAhFcSYN6P0AT6YA6wp4ikf9thVNBU32wV0rJ j2eNI3POxQ7q8YaJpWbobxGg/ifvQM0sX8fdYAxZsHxQRZxfihNAGZ0mA tCNPdw2in37DvOeA9laI/6U6bku4n1/2HZK3U2xdRFir9En71NsJF8eVN IQ0xREFMQ1sUyhj2cHhj3SWM8SE+0RsAM4v2wSLtfgPph5W0/G7SEDb1i g==; X-IronPort-AV: E=McAfee;i="6500,9779,10456"; a="294192360" X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="294192360" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 07:03:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="673363568" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 31 Aug 2022 07:03:14 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C48AA174; Wed, 31 Aug 2022 17:03:28 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown Subject: [PATCH v2 1/4] ACPI: platform: Get rid of redundant 'else' Date: Wed, 31 Aug 2022 17:03:24 +0300 Message-Id: <20220831140327.79149-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 In the snippets like the following if (...) return / goto / break / continue ...; else ... the 'else' is redundant. Get rid of it. Signed-off-by: Andy Shevchenko --- v2: no changes drivers/acpi/acpi_platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 1a1c78b23fba..75e26528056d 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -114,9 +114,9 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, INIT_LIST_HEAD(&resource_list); count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); - if (count < 0) { + if (count < 0) return NULL; - } else if (count > 0) { + if (count > 0) { resources = kcalloc(count, sizeof(struct resource), GFP_KERNEL); if (!resources) { From patchwork Wed Aug 31 14:03:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 601466 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 B7BEAECAAD1 for ; Wed, 31 Aug 2022 14:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbiHaOD0 (ORCPT ); Wed, 31 Aug 2022 10:03:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbiHaODY (ORCPT ); Wed, 31 Aug 2022 10:03:24 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94050D6B99; Wed, 31 Aug 2022 07:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661954602; x=1693490602; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sTmoYg+/fhXLwgBbkoLEM4CwBWesyXOqZ6VTvfe0paA=; b=bZK1Xh9xbmBerAeFKucg1bRCVXE8pfHC2P1acQ5gaUAOZjJm5BtjmSpE 8YH5gRV02/+3E2xUAgXDdqb/hmKsRrHoFxzSL/wzAu5Ucva3DpHmUoopd gpBbWSwU+xbGek5l0b8+tUgjJViE6KnL3MpaWoRZ9zjNCLeZ8tRBbsz6c gDEsJP9Hlkrk4v23fATykYCKZLvRyPOtIAZScHEQ1QLgk8IJBB8/5EygD Puml7ml8FtcVSyHd37UYOZjpHGzpI5ymz8qkanplP49+eCwPSAcYLlsnZ hCVZc0akg5F4KF2+TQjVi7RXehWW4E/sXE2wxzsHkxeUg9heXSYNWZpuC Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10456"; a="357171061" X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="357171061" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 07:03:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="563041420" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 31 Aug 2022 07:03:14 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CF90BAD; Wed, 31 Aug 2022 17:03:28 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown Subject: [PATCH v2 2/4] ACPI: platform: Remove redundant print on -ENOMEM Date: Wed, 31 Aug 2022 17:03:25 +0300 Message-Id: <20220831140327.79149-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220831140327.79149-1-andriy.shevchenko@linux.intel.com> References: <20220831140327.79149-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org We rely on somebody else to print enough information on memory allocation failures. So remove the log in the acpi_create_platform_device() when return -ENOMEM. Signed-off-by: Andy Shevchenko --- v2: slightly modified commit message to be prettier drivers/acpi/acpi_platform.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 75e26528056d..042f80588c18 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -120,7 +120,6 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, resources = kcalloc(count, sizeof(struct resource), GFP_KERNEL); if (!resources) { - dev_err(&adev->dev, "No memory for resources\n"); acpi_dev_free_resource_list(&resource_list); return ERR_PTR(-ENOMEM); } From patchwork Wed Aug 31 14:03:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 602204 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 61A8DECAAD1 for ; Wed, 31 Aug 2022 14:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229567AbiHaODS (ORCPT ); Wed, 31 Aug 2022 10:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231214AbiHaODQ (ORCPT ); Wed, 31 Aug 2022 10:03:16 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B37CD5DDE; Wed, 31 Aug 2022 07:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661954596; x=1693490596; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6EwmQveao5l0Fwty8NY+Z7wsdjEwNp5091Gc7ah/CRU=; b=igyePLAtkuP+tPf0S+3BuAUd4PgQsMLbqp3vxQXPq4ZxVAxK32v68l1d p1f5T9AasqbqNw3FlgOav4PCXqRZjfVxRtwGZLG7oOoKSorH15txL2YK0 RVJxnjjE5QtA1CQRj1WABl3eKUCSdSmbcVCiyLK/+VVDZoGtybRoULhZ3 MwnjSe4TDvSYlMjHvFPBhMgdraJi8LDHMELCdSaHjBytre8w+/e6udG9P BMCYbaIDCM5QWuBuhLM2BPg1peIUXVcMHjgDVJ+rZjU37BxXtKQVlwXGc gB+wepWExZJLSazFe8YLLPRAj/fZzkL/EZsr9bYJ+UeIcM10ZujIisbNZ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10456"; a="282425885" X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="282425885" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 07:03:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="940443522" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 31 Aug 2022 07:03:14 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D8D3119D; Wed, 31 Aug 2022 17:03:28 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown Subject: [PATCH v2 3/4] ACPI: platform: Use sizeof(*pointer) instead of sizeof(type) Date: Wed, 31 Aug 2022 17:03:26 +0300 Message-Id: <20220831140327.79149-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220831140327.79149-1-andriy.shevchenko@linux.intel.com> References: <20220831140327.79149-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org It is preferred to use sizeof(*pointer) instead of sizeof(type). The type of the variable can change and one needs not change the former (unlike the latter). No functional change intended. Signed-off-by: Andy Shevchenko --- v2: no changes drivers/acpi/acpi_platform.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 042f80588c18..0d812fe248d4 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -117,8 +117,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, if (count < 0) return NULL; if (count > 0) { - resources = kcalloc(count, sizeof(struct resource), - GFP_KERNEL); + resources = kcalloc(count, sizeof(*resources), GFP_KERNEL); if (!resources) { acpi_dev_free_resource_list(&resource_list); return ERR_PTR(-ENOMEM); From patchwork Wed Aug 31 14:03:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 602203 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 AD4DAECAAD1 for ; Wed, 31 Aug 2022 14:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231642AbiHaODd (ORCPT ); Wed, 31 Aug 2022 10:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231643AbiHaODZ (ORCPT ); Wed, 31 Aug 2022 10:03:25 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6CBFD6BA9; Wed, 31 Aug 2022 07:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661954603; x=1693490603; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5kccYvtkHvzcQzQhgfR8z09RnV+ThYRtA105LHeNCwk=; b=gk58dDMXmZWQlW33IwlI7KHAAea1ZhEtUtxFHRGqilbwjArapauGQ2tZ 7AKIE2zGkJkIiq6wlR7vNj72zPY6kwcxzfiaJHItkzoNmL6e3MKnjns+9 1SSv9714H/1UWBg9/re6u2shJ8Srrro61CjfS1df+geDQyo1+y3KRijnF 9XaLBaV3X+QI7MQyOG1qz5ZQLbLiNCbhGTHe7pAMrM81lh5tzGUWHe8b7 urJSIWs1rOCbC6Dwp5Gw3jZZ2HQgdyBSErCqmo2Z6rKKpCK76d2EoYZMb rfc1eM7oSrk9GIhyJm5RKD9T1WLH73Oc0nzmEWBd5FJkkCLydEbSMFzlr A==; X-IronPort-AV: E=McAfee;i="6500,9779,10456"; a="275200995" X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="275200995" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 07:03:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="680427489" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 31 Aug 2022 07:03:14 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EB8DD238; Wed, 31 Aug 2022 17:03:28 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown Subject: [PATCH v2 4/4] ACPI: platform: Sort forbidden_id_list[] in ascending order Date: Wed, 31 Aug 2022 17:03:27 +0300 Message-Id: <20220831140327.79149-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220831140327.79149-1-andriy.shevchenko@linux.intel.com> References: <20220831140327.79149-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org For easier maintenance, sort the forbidden_id_list[] table rows in ascending order with respect to the device ID field. While at it, use an empty row as the list terminator, which is more usual in the kernel. Signed-off-by: Andy Shevchenko --- v2 modified commit messages to be prettier (Rafael) drivers/acpi/acpi_platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 0d812fe248d4..f13409583cd9 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -20,13 +20,13 @@ #include "internal.h" static const struct acpi_device_id forbidden_id_list[] = { + {"ACPI0009", 0}, /* IOxAPIC */ + {"ACPI000A", 0}, /* IOAPIC */ {"PNP0000", 0}, /* PIC */ {"PNP0100", 0}, /* Timer */ {"PNP0200", 0}, /* AT DMA Controller */ - {"ACPI0009", 0}, /* IOxAPIC */ - {"ACPI000A", 0}, /* IOAPIC */ {"SMB0001", 0}, /* ACPI SMBUS virtual device */ - {"", 0}, + { } }; static struct platform_device *acpi_platform_device_find_by_companion(struct acpi_device *adev)