Message ID | 202301281451442100100@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1220583wrn; Fri, 27 Jan 2023 22:54:03 -0800 (PST) X-Google-Smtp-Source: AK7set/Teybmq7qXTxXVpHBE+T0vG/jW75FWlyEdqJkWblrv4DfmwRIQzr+32dksd5H4yqrGCqL0 X-Received: by 2002:a17:902:d4c3:b0:196:349f:4df3 with SMTP id o3-20020a170902d4c300b00196349f4df3mr13439239plg.50.1674888843361; Fri, 27 Jan 2023 22:54:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674888843; cv=none; d=google.com; s=arc-20160816; b=WnL1mvFlyfoejO1YY2T4rI8hgxuaqW8tmAbZh0dWVYkgxZn6Kn1imP/I9SxMkoPgZ8 y6H527c+UyIiU/xBKramKTzp13rAvWW2mp8n3L31ripu7rww3aiL6+uAGszFhKiU6/di ZQ8Utb0Lw1H3kJ+fmRb9Rf7YKxSsUgGZbWB+rapbMfU3nEgjwgTi4QhGQNkoE5mKkgxS 3wQSD5tpHEQigNR3DXYfe4xJSoQfHi1sO6vPitBn4uoI63lkGxHPYZaJ+P3vaH7OxIiy QMvXublD63BZU1lLzl9ccOFj0tlS34UknY9fnQuzcQnbRiSBOk/4D/8+BaDAtQztufXf o8ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=heyD0sTHzOunbr/omnQj6emt2Fkgcg6ZRUapgbp0BWU=; b=XBwXtG/qNGiGFpkW5hG8oeYmbI51vytd2sl+9vpVFC7IhfBgRyNaLpBnHtsB9PPrzZ +ewbFoZWwpu8ZGZHMJaRx2o+VOAEcPS/7mwxrGc85sJXg/CmAb+ex1pOoGNkuSvPjEgc OvMsDHvGY6r9RXCgrsVuM0IcehxFazqF//8IbMhKbINyVwWjMQcu39HlwAhTkCQKFtBO RedjG/vXQqyTlwyrOpj2OSNJKIpCekWUyv5wH0905jnUfYa8vhy5JMhjAwkroxxPAme7 Ot7LE2BJJZ0V59i2KwgzaC5hCFN47To4zHadRlDCEerZblriWnWHR5o1HSlsA5oHBeSd k0kQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t184-20020a6378c1000000b004ce5301edd9si6260673pgc.120.2023.01.27.22.53.51; Fri, 27 Jan 2023 22:54:03 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233040AbjA1Gvx (ORCPT <rfc822;jesperjuhl76@gmail.com> + 99 others); Sat, 28 Jan 2023 01:51:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232940AbjA1Gvw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 28 Jan 2023 01:51:52 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C1B2442CE; Fri, 27 Jan 2023 22:51:48 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4P3lVB1d6Cz6FK2Q; Sat, 28 Jan 2023 14:51:46 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.97.17]) by mse-fl1.zte.com.cn with SMTP id 30S6pg3h077569; Sat, 28 Jan 2023 14:51:42 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Sat, 28 Jan 2023 14:51:44 +0800 (CST) Date: Sat, 28 Jan 2023 14:51:44 +0800 (CST) X-Zmail-TransId: 2af963d4c600ffffffff9b6444a4 X-Mailer: Zmail v1.0 Message-ID: <202301281451442100100@zte.com.cn> Mime-Version: 1.0 From: <ye.xingchen@zte.com.cn> To: <wsa+renesas@sang-engineering.com> Cc: <linux-arm-kernel@lists.infradead.org>, <linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: =?utf-8?q?=5BPATCH=5D_i2c=3A_wmt=3A_Use_devm=5Fplatform=5Fget=5Fand?= =?utf-8?q?=5Fioremap=5Fresource=28=29?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 30S6pg3h077569 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63D4C602.000 by FangMail milter! X-FangMail-Envelope: 1674888706/4P3lVB1d6Cz6FK2Q/63D4C602.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/<ye.xingchen@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63D4C602.000/4P3lVB1d6Cz6FK2Q X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, T_SPF_PERMERROR,UNPARSEABLE_RELAY 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756248244168487958?= X-GMAIL-MSGID: =?utf-8?q?1756248244168487958?= |
Series |
i2c: wmt: Use devm_platform_get_and_ioremap_resource()
|
|
Commit Message
ye.xingchen@zte.com.cn
Jan. 28, 2023, 6:51 a.m. UTC
From: ye xingchen <ye.xingchen@zte.com.cn> Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> --- drivers/i2c/busses/i2c-wmt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Comments
Hi Ye, On Sat, Jan 28, 2023 at 02:51:44PM +0800, ye.xingchen@zte.com.cn wrote: > From: ye xingchen <ye.xingchen@zte.com.cn> > > Convert platform_get_resource(), devm_ioremap_resource() to a single > call to devm_platform_get_and_ioremap_resource(), as this is exactly > what this function does. > > Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> > --- > drivers/i2c/busses/i2c-wmt.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c > index 7d4bc8736079..4a3e3985e418 100644 > --- a/drivers/i2c/busses/i2c-wmt.c > +++ b/drivers/i2c/busses/i2c-wmt.c > @@ -372,7 +372,6 @@ static int wmt_i2c_probe(struct platform_device *pdev) > struct device_node *np = pdev->dev.of_node; > struct wmt_i2c_dev *i2c_dev; > struct i2c_adapter *adap; > - struct resource *res; > int err; > u32 clk_rate; > > @@ -380,8 +379,7 @@ static int wmt_i2c_probe(struct platform_device *pdev) > if (!i2c_dev) > return -ENOMEM; > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - i2c_dev->base = devm_ioremap_resource(&pdev->dev, res); > + i2c_dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); It's also a cleaner way to handle the error when res is NULL. Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Thanks, Andi > if (IS_ERR(i2c_dev->base)) > return PTR_ERR(i2c_dev->base); > > -- > 2.25.1
On Sat, Jan 28, 2023 at 02:51:44PM +0800, ye.xingchen@zte.com.cn wrote: > From: ye xingchen <ye.xingchen@zte.com.cn> > > Convert platform_get_resource(), devm_ioremap_resource() to a single > call to devm_platform_get_and_ioremap_resource(), as this is exactly > what this function does. > > Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Applied to for-next, thanks!
diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c index 7d4bc8736079..4a3e3985e418 100644 --- a/drivers/i2c/busses/i2c-wmt.c +++ b/drivers/i2c/busses/i2c-wmt.c @@ -372,7 +372,6 @@ static int wmt_i2c_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct wmt_i2c_dev *i2c_dev; struct i2c_adapter *adap; - struct resource *res; int err; u32 clk_rate; @@ -380,8 +379,7 @@ static int wmt_i2c_probe(struct platform_device *pdev) if (!i2c_dev) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - i2c_dev->base = devm_ioremap_resource(&pdev->dev, res); + i2c_dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(i2c_dev->base)) return PTR_ERR(i2c_dev->base);