Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3860621ybl; Mon, 27 Jan 2020 11:48:52 -0800 (PST) X-Google-Smtp-Source: APXvYqwShktNjVjueqJVo3voOPKDQciugi8HUw9JEUXZFLEmiHaEJ7ifclbwWIUNX/18TT0mmwsj X-Received: by 2002:a05:6830:1d4c:: with SMTP id p12mr14138713oth.198.1580154532565; Mon, 27 Jan 2020 11:48:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580154532; cv=none; d=google.com; s=arc-20160816; b=VJG2pew2cpq8VYI7UPjWnSQlB9tlcrR+XjqTYUWKPNqeAgDJZJZsK3Qs/g+V+0xXpG n8rYYe85nwGvfiwVHyeSBaHoPSTIDUExqlLWA0Ej1nCvUZYDMm01hNIH7aSQJVG1oWmS 21Po48Bxri8YnVo6fDNApN+EVPbvnx9vGI1M1brs9o5tQm5hvtb3PweQiB4Z+bDoIIq2 8f7jh2mZtO5S+XzM+t/b/uKIydX63+4GsbVuuTQq2bsuAV2LVud9NMEsJmIz+JrqJ/oF s7Q8Xin1gkLN7xhcW8oYgpbBhXjKYlrzRegzkAAT2j/Cg6wInzzxxrh4t/hniZaysjrc sMWQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=8N56+uwNzL4BtEV3m9/SZahhJM7vJj2lXnrPv331uNA=; b=fZRXvkCBUjv02TWCN1Y1mmXdoGhZQqr2e4YPPaFSWVaoyURE5DhZpn8Yxn4E4pdZI/ 3GdfmnArCWMM2WC9UwGHxr1fRLmeUIBpKzBw6hiW0zaoXpjdyxUgklf6lP09y2yPE7nf zJ5pS0eIXig0ty3NCexs+9Ygl+aBk2sA4Gra8KOFMe2XU6C60M+AIV7yU+kFp5fqIgif LIrXs6cvCLYE2O1S2C9M5cG1Hzi9mP+KDaJKgJwTzH6aLHXGGrGU9yBWAQKb5FitKTP/ K9ueO+7EQgKBlvdKNLnKaReXj/2Ipny+TThS9Vk2iiRDvQz7q2WXbTpETN7T+JEd9h9H HMig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GS4Cs8/z"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n21si4089242oic.0.2020.01.27.11.48.39; Mon, 27 Jan 2020 11:48:52 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GS4Cs8/z"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726101AbgA0Trl (ORCPT + 99 others); Mon, 27 Jan 2020 14:47:41 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36129 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbgA0Trl (ORCPT ); Mon, 27 Jan 2020 14:47:41 -0500 Received: by mail-lf1-f68.google.com with SMTP id f24so7171705lfh.3; Mon, 27 Jan 2020 11:47:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8N56+uwNzL4BtEV3m9/SZahhJM7vJj2lXnrPv331uNA=; b=GS4Cs8/z2H+nsAyIfkIssh2nPOu2dPROaVu1LjaSkVN2FxE7AIdvTaBysC+gP+WeNU HFRwweqZeek8jHre2PRJRpwWpbpB4YIKr1FzOyJx00TnlMGabzvp+Z9n1BO+J3r7KYrC 6zkYmGPdizAJxly9h7WwK+a7iP46YWU6LqmRHT2Cpi+/KZbLyrT/FctCi0x8KfjV3J4R tDRj9xS93hifbwrIwrJYZE+YGYlQ6DhkBkRLQwKw/e2pKQEhw8PzqXMkwtBNjfps1QNL oppuNRJXVaDWjteTPI+ZNbKpVqL73icMsK3xJbO5JOmY0xyY7q3hND70yR2NSTqOhOXs G4+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8N56+uwNzL4BtEV3m9/SZahhJM7vJj2lXnrPv331uNA=; b=cqwu60apsbe6rUqhUqTwJFryJ1+RZh8ICToT8SwKtE9AqApm1nh+Vsw8QRtgVWyTj3 P405IPVPEA/w2L3wCUNJubqZ0ns4HvpvWsEwXSHFmTYggPLD/cxywlpMsKbIdUKe45xt sCRvq2NBt+pSQ+SIPstUJQS5HeG1EaEyJ7qOmXtZ6O9SnK7A0yHB6gs45dgpIHSDr0GE CSP1H7qMKIVNxfmCzPeF1Ol4gVYJzPOgiCP/IKmi9+cjrNrsad6R7luGNQrfUdiJhcN0 9KrHzR6CjViy2ULBqswwhqiwhrEyNaJYwSEi/hfEUNMSWAFpFbMjjVuKn2JSX8lP5YM8 YTYA== X-Gm-Message-State: APjAAAUu2JPxgcSZlKDYfsWH8M0IhPudAjv2oDP+kYNG2JPYZpOBFg7x +8s5TY8wS8fdP0ttvSUBlxrjjGAF X-Received: by 2002:ac2:4c84:: with SMTP id d4mr159657lfl.64.1580154458315; Mon, 27 Jan 2020 11:47:38 -0800 (PST) Received: from [192.168.2.145] (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.googlemail.com with ESMTPSA id w19sm8581143lfl.55.2020.01.27.11.47.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jan 2020 11:47:37 -0800 (PST) Subject: Re: [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource() To: Dejin Zheng , gregkh@linuxfoundation.org, thierry.reding@gmail.com, jonathanh@nvidia.com Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200127135841.17935-1-zhengdejin5@gmail.com> From: Dmitry Osipenko Message-ID: Date: Mon, 27 Jan 2020 22:47:36 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20200127135841.17935-1-zhengdejin5@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 27.01.2020 16:58, Dejin Zheng пишет: > make the code simple by use devm_platform_ioremap_resource() function > to replace platform_get_resource() and devm_ioremap(). > > Signed-off-by: Dejin Zheng > --- > drivers/usb/phy/phy-tegra-usb.c | 20 ++------------------ > 1 file changed, 2 insertions(+), 18 deletions(-) > > diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c > index ea7ef1dc0b42..8220bb4ce1ed 100644 > --- a/drivers/usb/phy/phy-tegra-usb.c > +++ b/drivers/usb/phy/phy-tegra-usb.c > @@ -944,20 +944,12 @@ static int read_utmi_param(struct platform_device *pdev, const char *param, > static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, > struct platform_device *pdev) > { > - struct resource *res; > int err; > struct tegra_utmip_config *config; > > tegra_phy->is_ulpi_phy = false; > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > - if (!res) { > - dev_err(&pdev->dev, "Failed to get UTMI pad regs\n"); > - return -ENXIO; > - } > - > - tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start, > - resource_size(res)); > + tegra_phy->pad_regs = devm_platform_ioremap_resource(pdev, 1); > if (!tegra_phy->pad_regs) { > dev_err(&pdev->dev, "Failed to remap UTMI pad regs\n"); > return -ENOMEM; > @@ -1054,7 +1046,6 @@ MODULE_DEVICE_TABLE(of, tegra_usb_phy_id_table); > static int tegra_usb_phy_probe(struct platform_device *pdev) > { > const struct of_device_id *match; > - struct resource *res; > struct tegra_usb_phy *tegra_phy = NULL; > struct device_node *np = pdev->dev.of_node; > enum usb_phy_interface phy_type; > @@ -1071,14 +1062,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) > } > tegra_phy->soc_config = match->data; > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!res) { > - dev_err(&pdev->dev, "Failed to get I/O memory\n"); > - return -ENXIO; > - } > - > - tegra_phy->regs = devm_ioremap(&pdev->dev, res->start, > - resource_size(res)); > + tegra_phy->regs = devm_platform_ioremap_resource(pdev, 0); > if (!tegra_phy->regs) { > dev_err(&pdev->dev, "Failed to remap I/O memory\n"); > return -ENOMEM; > Hello Dejin, Unfortunately this is not a correct change because registers are shared by both PHY and USB controllers on Tegra SoCs. The devm_platform_ioremap_resource() can't be used here because it makes the mapping exclusive for a single driver, while it should be shared.