Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5919950rwb; Wed, 7 Sep 2022 09:50:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR4YUIJbSelRC9Kio8MujkSHX7ZO3qtRstFccZTMrC8COkJHAPWXXJLwdQZXzwA95+UboldX X-Received: by 2002:a17:907:72c3:b0:770:8086:78ab with SMTP id du3-20020a17090772c300b00770808678abmr2693724ejc.229.1662569422110; Wed, 07 Sep 2022 09:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662569422; cv=none; d=google.com; s=arc-20160816; b=DL1n2Vnw0QYlEpGAQewWSENDb1J030GR0BEX/F8uRr/zkbfinGE/wjEnxf+qMaKjwi mNUl/EwbrdCC61ANGWcpE0bjsDlEsyDcqSKQlEj2OLlMQeJZriRcBhVtb1/JUueG3ONx muP8mtBzY55HFN2SAPIzBBdeLPhbgfG9wPWEAXOX+G2L6OVOXDhoGxq/VJlvWyM3C3kS WMLK6S41VtwCBRCeLeNLrq3prUIj3gjibEf1ICkxX6/x8ncFq+izDAFPeiO6Ht3CHeW5 XN6geiARQIHZsgH+xD6ulnea+AsGivKIe+Qnw6FtpLGJoPPcZ4w6Yfr0e4F9WbB8lk/F 8mUw== 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=91jWklP+GaoUSu+OQYmNTZ7W9JH4oHrbmayh/8gXrfk=; b=TjXZpKPVnQuoR56QnK8W2TyOnWUelK+AYPqkGPSX63RiKOJiqGCCED69/MxuZNz/4i 4iD1xXiYbxupMCTMLr51NIc6lElO//jGBuGdJ31nMvfWnhz9N6E9TmjhFGLmOJeK6QHM FHve2EFH1ami5u4bfWsVArGtHUy3hdWGQlr6krO0vHyZjC/Lo8iX6ZIu8WeTFkn4vuPN a62jjFfTrpce+rnX7nPB8ld6JtKuUq2wmfHQ/3rk6eFOUQQJtSo/cvr2jermuLutVgBZ Nx4iRLhnrRYAD9E4QL05h2u5TRTR8ohuV2/sB2+wlJgjmy8NLkN6vD7KHpGY++9fTj39 wf/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N2UxokTh; 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 cs7-20020a0564020c4700b00446eb5c6a3fsi3136520edb.555.2022.09.07.09.49.57; Wed, 07 Sep 2022 09:50: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=N2UxokTh; 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 S230331AbiIGQrO (ORCPT + 99 others); Wed, 7 Sep 2022 12:47:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbiIGQqp (ORCPT ); Wed, 7 Sep 2022 12:46:45 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C0E6BBA4F; Wed, 7 Sep 2022 09:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662569202; x=1694105202; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s8qb/UTEEil6615JKf6e9+EljojGbq/vMMOf6vhsxNk=; b=N2UxokThIGGWJhrB+OLWvXus5Ms1U3EApEvOqBuz0MoQT4zAa7eWIWXL Cub0PqHJyT502/FaB49C+jOqCz2SJrW42mmbhFUYj1UWafp7fSWVl5Yc9 2o7MD2ALwGlojqUB8iKD0/bKq9tgzMA5VGk2+Q9qPEmlZahE6L6ljvGvy DfNco35zzthgWEWZbmiMv9iw+ubrdre3OhmoRrqD3icO+mKp2reUydNkk 5YdemHWj4dUeLOlQfkg71rlJH0Qt1R/hlOe2Oj8F6hyDYQwqi0DicYC4x xCfh70NG+eFUMk/ebo6k/mjw33G3Lgj151dQSQ/xCa33Ovk5yDMOqbmvm A==; X-IronPort-AV: E=McAfee;i="6500,9779,10463"; a="295667998" X-IronPort-AV: E=Sophos;i="5.93,297,1654585200"; d="scan'208";a="295667998" Received: from orsmga003.jf.intel.com ([10.7.209.27]) 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="565591846" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 07 Sep 2022 09:46:03 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 11A29235; 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 5/8] i2c: mlxbf: Refactor _UID handling to use acpi_dev_uid_to_integer() Date: Wed, 7 Sep 2022 19:46:03 +0300 Message-Id: <20220907164606.65742-6-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/i2c/busses/i2c-mlxbf.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index 8716032f030a..4fd4b3799596 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -2230,34 +2230,27 @@ static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv) { const struct acpi_device_id *aid; struct acpi_device *adev; - unsigned long bus_id = 0; - const char *uid; + u64 bus_id; int ret; if (acpi_disabled) return -ENOENT; - adev = ACPI_COMPANION(dev); - if (!adev) - return -ENXIO; - aid = acpi_match_device(mlxbf_i2c_acpi_ids, dev); if (!aid) return -ENODEV; priv->chip = (struct mlxbf_i2c_chip_info *)aid->driver_data; - uid = acpi_device_uid(adev); - if (!uid || !(*uid)) { + ret = acpi_dev_uid_to_integer(adev, &bus_id); + if (ret) { dev_err(dev, "Cannot retrieve UID\n"); - return -ENODEV; + return ret; } - ret = kstrtoul(uid, 0, &bus_id); - if (!ret) - priv->bus = bus_id; + priv->bus = bus_id; - return ret; + return 0; } #else static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv) -- 2.35.1