Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1021560pxk; Fri, 18 Sep 2020 01:28:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoKzi08X7SRWvGjlRkPjQYZiBT6zK9Egn4Is/S9mAsyomJco2ExQJXKdVwMYxOYUXQBIov X-Received: by 2002:a05:6402:1717:: with SMTP id y23mr38962930edu.112.1600417693532; Fri, 18 Sep 2020 01:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600417693; cv=none; d=google.com; s=arc-20160816; b=UFh4XivhZFtRub7Ha2NMFALiQErxKCA8HUPBjcrakdCi6R9xIVNKzAVLf2CjnAofuj 70wIUlKRKUNRFIUEZQ1qekw/nE+N2zWcF3gvWqnJhCWG7kd0PcNZ4JaiZIYS6X8J7OIc /ceRMu3lBvnx/HhT/+gkDp8OhN8LLjeCFOqx8jX/c/Nyq/Un7B8WmcL6qHHVA6Fe2+Wu C+6nAVa+W9he8TAsu2AYZ7zJ34K9Bdj2mKvsE1b+DFh+zvLWG+Qkm736LoLH0Y7CfOfI RLllIbGGB6iboSClLByUltgkAi9wUVFaBwg0nNu8ErcopuSyvXLFYrT4fjpY5ufcRwW7 psHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:mime-version:message-id:date:subject:cc:from; bh=JS8mqGSbWlIR45Gd9e4UjFLkuLPTEPU1zA5rOdcjxO8=; b=EuoBheO5fUGL5QnUS6y3dFA82XSxjDbeNjYvcfQCtWN1n5sTR+exLTXK9N+CePXHGJ FM2BID5woTZpNsXUdBw6nvscIMzEd2xyuMTwc6d8ZhnJZlIBX7zaMT90rdw4VVrispiT +Jn2sRj5qtVecpOweCPx9o1JWuDSo2rMV4evZht+bEpZlrQe46tz441WvoKc1SQATetW 6C/WzR+z7RoQ9T5xQBC8zGdyArqpWG0hTHV/t/PqiTsNVYEBEffEuaxRK5X3Ly36liRA Tsow/9KiWN9z2E8KjdqWG9gTTET7Wdt5bQngt6QVvpRuPDQK7cOs/4XUgIBRnfr7H3Q6 yibw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si1568109edm.404.2020.09.18.01.27.50; Fri, 18 Sep 2020 01:28:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726427AbgIRIZ4 (ORCPT + 99 others); Fri, 18 Sep 2020 04:25:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13293 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726171AbgIRIZ4 (ORCPT ); Fri, 18 Sep 2020 04:25:56 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 861BA7C7D61215C724CB; Fri, 18 Sep 2020 16:25:48 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Fri, 18 Sep 2020 16:25:41 +0800 From: Wang ShaoBo CC: , , , , , , Subject: [PATCH -next] i2c: efm32: Use devm_platform_get_and_ioremap_resource() Date: Fri, 18 Sep 2020 16:25:08 +0800 Message-ID: <20200918082508.32427-1-bobo.shaobowang@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make use of devm_platform_get_and_ioremap_resource() provided by driver core platform instead of duplicated analogue. dev_err() is removed because it has been done in devm_ioremap_resource(). Signed-off-by: Wang ShaoBo --- drivers/i2c/busses/i2c-efm32.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-efm32.c b/drivers/i2c/busses/i2c-efm32.c index 838ce0947191..f6e13ceeb2b3 100644 --- a/drivers/i2c/busses/i2c-efm32.c +++ b/drivers/i2c/busses/i2c-efm32.c @@ -332,21 +332,15 @@ static int efm32_i2c_probe(struct platform_device *pdev) return ret; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "failed to determine base address\n"); - return -ENODEV; - } + ddata->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(ddata->base)) + return PTR_ERR(ddata->base); if (resource_size(res) < 0x42) { dev_err(&pdev->dev, "memory resource too small\n"); return -EINVAL; } - ddata->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(ddata->base)) - return PTR_ERR(ddata->base); - ret = platform_get_irq(pdev, 0); if (ret <= 0) { if (!ret) -- 2.17.1