From patchwork Sat Jul 9 00:07:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 589156 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 50516C43334 for ; Sat, 9 Jul 2022 00:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229594AbiGIAHz (ORCPT ); Fri, 8 Jul 2022 20:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbiGIAHQ (ORCPT ); Fri, 8 Jul 2022 20:07:16 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDCF66B85; Fri, 8 Jul 2022 17:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657325229; x=1688861229; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=cpONHfvICP0pLZXFSpNN1+uSymjEqhVrTSEJEUFETFI=; b=kUqRGrkshvFWGaxINcdFvZsGEVFUoHgehsmv1AUvshWSA2ThYv1CYbHW 0iFEKWcvyAXG+PipFD54k+Dvo/6xzkCU4drBx4vLHDivbVuX2j8xdKWq0 nROOjQx4t4FGWpcrBXm1Rw/Wmum9q99ifWLCmQ2/Y3xK9As7eJTtPCwAH z2e0GRV9oHOIqWO88xQudxSAejtJ78/mfu6QrKDxuekVjelezfL9aH5tR 6C1gHZWEU3AzZncjMgPenryH4sz1AAw5q/zeFaarCxPj21wpW6GGL9iKa 8R6k7Fem5lgGNh4JZAwJhyM+YAsFynemrTxq88yiPfiIepeKVKzpChLv3 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10402"; a="284411926" X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="284411926" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2022 17:07:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="840459575" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 08 Jul 2022 17:07:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C44D1CE; Sat, 9 Jul 2022 03:07:14 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 1/2] spi: propagate error code to the caller of acpi_spi_device_alloc() Date: Sat, 9 Jul 2022 03:07:08 +0300 Message-Id: <20220709000709.35622-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-spi@vger.kernel.org Since acpi_spi_device_alloc() has been designed to return an error pointer we may now properly propagate error codes to the caller of it. It helps debugging a lot. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 0690f018c413..d4a8665410ea 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2565,7 +2565,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, if (ret < 0) /* Found SPI in _CRS but it points to another controller */ - return ERR_PTR(-ENODEV); + return ERR_PTR(ret); if (!lookup.max_speed_hz && ACPI_SUCCESS(acpi_get_parent(adev->handle, &parent_handle)) && From patchwork Sat Jul 9 00:07:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 588857 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 B44B8C433EF for ; Sat, 9 Jul 2022 00:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229840AbiGIAHz (ORCPT ); Fri, 8 Jul 2022 20:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbiGIAHQ (ORCPT ); Fri, 8 Jul 2022 20:07:16 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B458466B83; Fri, 8 Jul 2022 17:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657325229; x=1688861229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TFn/sMvlvQR9LES2lJ5zpS9l2SX8VRuOj2PgTtGMOGY=; b=TuyigJmn09d1pW+/qet1FswMl0u2XrTDXvvAsIDDBp6VhAIo7LAEZMvn 5Y1K6ASV6aUAkLYR2abL5suC9ENlVY76GzNSyG6syQU8YmS3y85jiz/mU l4uutqjiBA6el0fn1GiO0Jups6quaBSKWBS0nqcCodY48WFDLs5k3fC8K OBYNchtTZqrO6ci83l0OhVe9wpwJgwz+mZP+N0wEowyLfh8EWaAs596te KgHDIZ7qQvkQEKvFbJd1AH8/mtH4UQWnxYUviy5vUIYjVAIJ+LCAoiaJv fkZj7pf5O8dTI9Ylut1Y/ZPmkg3G4OiMstu7ofbX3ySxEB00QJ/zddvMO g==; X-IronPort-AV: E=McAfee;i="6400,9594,10402"; a="285516172" X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="285516172" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2022 17:07:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="651754287" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 08 Jul 2022 17:07:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CD398AD; Sat, 9 Jul 2022 03:07:14 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 2/2] spi: remove duplicate parameters check in acpi_spi_add_resource() Date: Sat, 9 Jul 2022 03:07:09 +0300 Message-Id: <20220709000709.35622-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220709000709.35622-1-andriy.shevchenko@linux.intel.com> References: <20220709000709.35622-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The acpi_spi_add_resource() is never called with ctrl == NULL and index == -1. The only caller already performs the check. Hence remove the duplication from the acpi_spi_add_resource(). Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d4a8665410ea..9b080dafa52c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2459,9 +2459,6 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data) if (lookup->index != -1 && lookup->n++ != lookup->index) return 1; - if (lookup->index == -1 && !ctlr) - return -ENODEV; - status = acpi_get_handle(NULL, sb->resource_source.string_ptr, &parent_handle);