Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5927040rwb; Wed, 7 Sep 2022 09:57:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR7XZ3kJyrvz7fo7Q+3SgVSVbRSIwH+GLrZo6SR/rcIDAw8IgNnD3SqnTf86BtVbZVwYJXXv X-Received: by 2002:a05:6402:156:b0:440:b458:93df with SMTP id s22-20020a056402015600b00440b45893dfmr3979571edu.337.1662569856630; Wed, 07 Sep 2022 09:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662569856; cv=none; d=google.com; s=arc-20160816; b=SlLnniozkQY7yJDAiWR2RAsVAYwIJBgi9uQgs4K3Rd0vwHs1QMtgntkGRu2Sd2aaUe W2xXviBLMsTeliONvhGuMQeLqG2MZMvkRJSCHPKNlkreYni0uwHoIAEavCY8aAXX4qpa RLNVJogAox6YC0JAqoKpldR5L9FhzVc82R9dGYAzFbNc3RJi4Btrt9MBfeZSKvY9PSqP KM+DUxwtVU/57iE7Hme9KE1ZTmpaENTYYlaXu1hsneG6HNOTAEVcIZc2KGJ1zNKctwRw umAGJ5LgtXuToVvHc7kYz5YEIROY+WBa99xwKBzwQeGuOrxMmsfkGftQFXWhK2pCnBMV dzJA== 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=D1GzFZ3MxCQqXPg2MkEj2GgwKjKKH06EWgwVXkRP9wk=; b=oGW5MXu2A41ZkYB+iPEfyYK4IvY2kZ/Irk08e7GjZDdFX19+9V56RTl8jpVqS2OPPU +Vpf+pawOy4P99L9ZJvdsqF90yQ/zw72GyrXfZl3oSceattiSGjZ3LIzqPfUxwhPmVn7 pZCxCrTvu2zed2dvVPubGDeiyZjw38gEpel3zQlbC7xdVJ85kfKxUe8xh9OLHFOLDvXR Sjz4GcSzjzyh8VjzxjbzNmD/NoUJ/apl3VTxgiN0mtg6AWPJtYci4lMhI5vgkCTT4JJm IFaT0yRjv+0EhUJngZZMaWY4igd+yAeCkXYOHw7rRXH2MIgBWyl1uNhyhPS8HzAG2T7U SnVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="FfgMr2M/"; 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 fg7-20020a056402548700b0044811b18be1si11394363edb.631.2022.09.07.09.57.09; Wed, 07 Sep 2022 09:57:36 -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="FfgMr2M/"; 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 S229936AbiIGQqo (ORCPT + 99 others); Wed, 7 Sep 2022 12:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbiIGQqm (ORCPT ); Wed, 7 Sep 2022 12:46:42 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 435FC23145; Wed, 7 Sep 2022 09:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662569196; x=1694105196; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IhpjY4pXNZR+1OqitHXjkeJ8yaTjjGkFJMIQ6pO2qoI=; b=FfgMr2M/db81UhxdlzU/5U29wo/AOH8vnMW5Dd15ij5qWEjrUs/t98Ua LVoSlkN0ucUKsfjskaSYEIzBimXpCDExemSfHj+fCFaCmImkH5d6EC+WS mojfPtPEhrPlukzn30wqqMC30PB4/Ph1tCEy+Ze/xzxWVvNcV1fVANLp9 7Pm0P6B8BdUmrT/DyiBSzPLa2cpSDiZWHcCopzbnK/cgPV/3BKyRZDN+4 +O0CqamjQRLM1TCYajIjEh9eT+QVBWpVxCLo/fyMvl3oryvV0jz78e3ml Vwh9o9hEB4P0ix7z5xnZfuNM4MIw6Ka+u2Yb1EYKh9Tw9cC7xlUJAhMXl g==; X-IronPort-AV: E=McAfee;i="6500,9779,10463"; a="295667997" X-IronPort-AV: E=Sophos;i="5.93,297,1654585200"; d="scan'208";a="295667997" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 09:46:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,297,1654585200"; d="scan'208";a="790116153" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 07 Sep 2022 09:46:03 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 352895E4; Wed, 7 Sep 2022 19:46:12 +0300 (EEST) From: Andy Shevchenko To: "Rafael J. Wysocki" , Andy Shevchenko , Wolfram Sang , Hans de Goede , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, devel@acpica.org Cc: "Rafael J. Wysocki" , Len Brown , Ard Biesheuvel , Elie Morisse , Nehal Shah , Shyam Sundar S K , Khalil Blaiech , Andy Gross , Bjorn Andersson , Konrad Dybcio , Will Deacon , Mark Rutland , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , Robert Moore , Wolfram Sang Subject: [PATCH v1 7/8] spi: pxa2xx: Refactor _UID handling to use acpi_dev_uid_to_integer() Date: Wed, 7 Sep 2022 19:46:05 +0300 Message-Id: <20220907164606.65742-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220907164606.65742-1-andriy.shevchenko@linux.intel.com> References: <20220907164606.65742-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 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 ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as an integer. Use it instead of custom approach. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 4749dd598ec2..01a513d6c6b0 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1321,30 +1321,6 @@ static void cleanup(struct spi_device *spi) kfree(chip); } -#ifdef CONFIG_ACPI - -static int pxa2xx_spi_get_port_id(struct device *dev) -{ - struct acpi_device *adev; - unsigned int devid; - int port_id = -1; - - adev = ACPI_COMPANION(dev); - if (adev && adev->pnp.unique_id && - !kstrtouint(adev->pnp.unique_id, 0, &devid)) - port_id = devid; - return port_id; -} - -#else /* !CONFIG_ACPI */ - -static int pxa2xx_spi_get_port_id(struct device *dev) -{ - return -1; -} - -#endif /* CONFIG_ACPI */ - static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) { return param == chan->device->dev; @@ -1354,12 +1330,15 @@ static struct pxa2xx_spi_controller * pxa2xx_spi_init_pdata(struct platform_device *pdev) { struct pxa2xx_spi_controller *pdata; + struct device *dev = &pdev->dev; struct ssp_device *ssp; struct resource *res; struct device *parent = pdev->dev.parent; u32 value = SSP_UNDEFINED; enum pxa_ssp_type type; const void *match; + int status; + u64 uid; /* Always try to read property */ device_property_read_u32(&pdev->dev, "intel,spi-pxa2xx-type", &value); @@ -1402,7 +1381,12 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) ssp->type = type; ssp->dev = &pdev->dev; - ssp->port_id = pxa2xx_spi_get_port_id(&pdev->dev); + + status = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid); + if (status) + ssp->port_id = -1; + else + ssp->port_id = uid; pdata->is_slave = device_property_read_bool(&pdev->dev, "spi-slave"); pdata->num_chipselect = 1; -- 2.35.1