Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp369552ybx; Wed, 6 Nov 2019 01:55:07 -0800 (PST) X-Google-Smtp-Source: APXvYqwYyXnHpVkBIWXulHNRd3r8BiswyhhtGZde9r5mlJ14gBGhuh8QFpoNIFFqivGnfdD33SN3 X-Received: by 2002:a17:906:ccd6:: with SMTP id ot22mr33796054ejb.166.1573034107403; Wed, 06 Nov 2019 01:55:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573034107; cv=none; d=google.com; s=arc-20160816; b=WyWsi1/ZPAQSDUGyF4cz2OGVLesPGhOtzSAXmeCiOyAMJ5uP0yns+AjZxXjIXtHVDQ Fiytpoa8oddiUv8V+yZwUakR3j80iwmqvSegsAtvp/9Nujf3Q8/Se+i4jWH3tM+a8/Te KgN/HpdgOz54nbAwCPWPCz+ZaxRQr5HzT3S4Jr3jVPlRRudJudvxSujIbFGYBe/xPdu6 iAL9B/6Lz62xxq4yO8ezfmvKqpD4I64PNELJA5Ec/fF0LpHl9q1TdrhT3rjm26eI4NrI JXfbgxuAcvoTkoBoYET/HxLw+dxPvcqVSTFPLKN6GCFPTjK/OugDRCXny625NXuiYn77 HVlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=h0gV+fjwtmDsJk4NAYtmN3PwPdst92Msz9nFYzOHak4=; b=HTHwnqprexKtScsrU400iHWSDMn63e04Md8nfazgTZdP413A8M53aS35QywjlNIPRA w7tSs4N4jpw861KwYhw/KR0PZEnSVt1eqPKmBs2FOXY13oYYLayZj/U1M51wQZVPlfQL NBTriIYGj8sMoOL0iQDwXHjnTSp8kHMLBm2euLMjCpTHB1lh8Hik7qGKl8VCO4s8HOxr 0sCXkaxsxo6jULFXwkpeDO6VewlTV6CMVwTTkWGCpgrrG+yie7FN+/O4I1ie/yp0KHEV 9gXK7thwYW4BEXtUYkwVcdCcGck1ckVnS+JKRLZ1k4tyrOtCLjWV8tO1wqOD22XINaz3 XClA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si6454372ejr.320.2019.11.06.01.54.44; Wed, 06 Nov 2019 01:55:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731818AbfKFJvN (ORCPT + 99 others); Wed, 6 Nov 2019 04:51:13 -0500 Received: from sauhun.de ([88.99.104.3]:50186 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727485AbfKFJuh (ORCPT ); Wed, 6 Nov 2019 04:50:37 -0500 Received: from localhost (p54B33505.dip0.t-ipconnect.de [84.179.53.5]) by pokefinder.org (Postfix) with ESMTPSA id E43422C054E; Wed, 6 Nov 2019 10:50:35 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Benson Leung , Enric Balletbo i Serra , linux-kernel@vger.kernel.org Subject: [RFC PATCH 04/12] platform: chrome: convert to i2c_new_scanned_device Date: Wed, 6 Nov 2019 10:50:22 +0100 Message-Id: <20191106095033.25182-5-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191106095033.25182-1-wsa+renesas@sang-engineering.com> References: <20191106095033.25182-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move from the deprecated i2c_new_probed_device() to the new i2c_new_scanned_device(). Make use of the new ERRPTR if suitable. Signed-off-by: Wolfram Sang --- Build tested only. RFC, please comment and/or ack, but don't apply yet. drivers/platform/chrome/chromeos_laptop.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index 8723bcf10c93..4f3651fcd9fe 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -63,7 +63,7 @@ struct acpi_peripheral { struct chromeos_laptop { /* * Note that we can't mark this pointer as const because - * i2c_new_probed_device() changes passed in I2C board info, so. + * i2c_new_scanned_device() changes passed in I2C board info, so. */ struct i2c_peripheral *i2c_peripherals; unsigned int num_i2c_peripherals; @@ -87,8 +87,8 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, * address we scan secondary addresses. In any case the client * structure gets assigned primary address. */ - client = i2c_new_probed_device(adapter, info, addr_list, NULL); - if (!client && alt_addr) { + client = i2c_new_scanned_device(adapter, info, addr_list, NULL); + if (IS_ERR(client) && alt_addr) { struct i2c_board_info dummy_info = { I2C_BOARD_INFO("dummy", info->addr), }; @@ -97,9 +97,9 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, }; struct i2c_client *dummy; - dummy = i2c_new_probed_device(adapter, &dummy_info, - alt_addr_list, NULL); - if (dummy) { + dummy = i2c_new_scanned_device(adapter, &dummy_info, + alt_addr_list, NULL); + if (!IS_ERR(dummy)) { pr_debug("%d-%02x is probed at %02x\n", adapter->nr, info->addr, dummy->addr); i2c_unregister_device(dummy); @@ -107,12 +107,14 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, } } - if (!client) + if (IS_ERR(client)) { + client = NULL; pr_debug("failed to register device %d-%02x\n", adapter->nr, info->addr); - else + } else { pr_debug("added i2c device %d-%02x\n", adapter->nr, info->addr); + } return client; } -- 2.20.1