Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1035520imw; Fri, 8 Jul 2022 17:11:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vCEF5MTXHlXZVhwxdalQFgfT5LzJGqkwzovvLZPh28ouEFjFF9t3LIpbsiFFOliWgZRQQt X-Received: by 2002:a17:90b:388b:b0:1ed:406:492c with SMTP id mu11-20020a17090b388b00b001ed0406492cmr2796205pjb.31.1657325482634; Fri, 08 Jul 2022 17:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657325482; cv=none; d=google.com; s=arc-20160816; b=cmTYAsuwvX7u3o750Sciq87vRfknEL4Z8Slfnhe7nmI/U0B8+E9zW3oml2mvWBguYZ tPTCiIG2ryNNTbzjzJ2c4D/aNf5CXFZ89kdi/DA1ecwiniUtT49rKgYVsxAMw9wfo2X7 fOMpB2AtcPVCLuWoFBjEvogz75JUqnGYFyjqzTXzQ52jQr0UyCTAd9jmwJPBhUvkAbi7 JjONQ6OQq0T10A/GH/+ES+fknKNGqauUq9+vwfl38DiTvjXpi/pbHNcrOgzIcgYGPy4C IAki65uTgGWtsj5JeedppqTKELu8dwygMY1n95mpND6stc9fk1otICspfH43augQ/i3E tNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hQyLeYTDfTVn0RpFMlGIOxISkOYF0pNm6nR/cZGXHcE=; b=oyNjdB/dM5CTRuj3TJ2fknILDMxHNRTGxv+2k6zNrNgmAmqozjjUHjs+G9MYMke707 3lMTr1u6UPsEWSDROHBppzM+tab/fPGq4lRdXR+HJM+MuGHpi/XGtDl3gyMlEK+Atuz0 H+SmcFPHmbuBQgAuWRokVEUr0eVhf+WnYgLI49g5vUc3+fbyLoZtG72ggPBF5/X269Wu TLY9yhXjVCIl3Xn701jgNxIyFvBllgAQBu3MjeVwDlAD4uSAqh0zXKL3cHw/QWt1hm/r GzRledYcAg29BGAGhXd9B0BIffyYvOZC46iVsyT8INGsXjKtGnkVbH/SLAdc4OYEl/lF jZZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WWl8VHMk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a056a00130300b0052ab931ec55si509746pfu.184.2022.07.08.17.11.10; Fri, 08 Jul 2022 17:11:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WWl8VHMk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229958AbiGIAHd (ORCPT + 99 others); Fri, 8 Jul 2022 20:07:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbiGIAHJ (ORCPT ); Fri, 8 Jul 2022 20:07:09 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BE1766AFA; Fri, 8 Jul 2022 17:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657325201; x=1688861201; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2PHVLxm0nwiHtIkBNkq8RAlB72SqG9LFMuILiBDy8xs=; b=WWl8VHMkUidl+JIgh/NTlDF3KoD8PpjOvMDBVNoCvqoc0rJcy0p3cYuz BnfHTVrqVXelcEDK26LKYHl1k3+GCoSYWtnfI3ynKIEDlEIaA0kc0cnDB p8+lj8Y+eIxnBdfa5WVL1jtOZ+g6MJnYrTcb4wqt+kOZi1hhcF7Q3yGgf 2DqpqjaOKOjWt2wGQCq6EYJ8/O9ilao4My42d3oA5VPJGo4gSbBofD2yc aTOBfmiQ4Dw8Lo+h7W87OUGuYkxJlglSDSUg4+ibRts2vq7x5D1c70eer yeJJ8yzkn4ICmMBL91XpbddX2ac5KQGZY8d6bnAA8NIhMCEB8b6MVuBsF Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10402"; a="264802886" X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="264802886" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2022 17:06:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="683821846" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 08 Jul 2022 17:06:39 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8DA39481; Sat, 9 Jul 2022 03:06:46 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mark Gross , Andy Shevchenko Subject: [PATCH v1 2/7] platform/x86: serial-multi-instantiate: Improve autodetection Date: Sat, 9 Jul 2022 03:06:31 +0300 Message-Id: <20220709000636.35550-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220709000636.35550-1-andriy.shevchenko@linux.intel.com> References: <20220709000636.35550-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of calling specific resource counter, let just probe each of the type and see what it says. Also add a debug message when none is found. Signed-off-by: Andy Shevchenko --- drivers/platform/x86/serial-multi-instantiate.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c index 97db23243018..e599058196bb 100644 --- a/drivers/platform/x86/serial-multi-instantiate.c +++ b/drivers/platform/x86/serial-multi-instantiate.c @@ -232,6 +232,7 @@ static int smi_probe(struct platform_device *pdev) const struct smi_node *node; struct acpi_device *adev; struct smi *smi; + int ret; adev = ACPI_COMPANION(dev); if (!adev) @@ -255,15 +256,20 @@ static int smi_probe(struct platform_device *pdev) case SMI_SPI: return smi_spi_probe(pdev, adev, smi, node->instances); case SMI_AUTO_DETECT: - if (i2c_acpi_client_count(adev) > 0) - return smi_i2c_probe(pdev, adev, smi, node->instances); - else - return smi_spi_probe(pdev, adev, smi, node->instances); + ret = smi_i2c_probe(pdev, adev, smi, node->instances); + if (ret && ret != -ENOENT) + return ret; + ret = smi_spi_probe(pdev, adev, smi, node->instances); + if (ret && ret != -ENOENT) + return ret; + if (ret) + return dev_err_probe(dev, ret, "Error No resources found\n"); + break; default: return -EINVAL; } - return 0; /* never reached */ + return 0; } static int smi_remove(struct platform_device *pdev) -- 2.35.1