Received: by 10.192.165.148 with SMTP id m20csp4976461imm; Tue, 1 May 2018 07:09:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQMsK7wom7qp6RZ6ZAb7bsSOj7qqWJ81qnbGrcP+V71K4mBev4QVHhIC7lq6k5KUEgh8ku X-Received: by 2002:a65:6188:: with SMTP id c8-v6mr13220597pgv.131.1525183743759; Tue, 01 May 2018 07:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525183743; cv=none; d=google.com; s=arc-20160816; b=jUDaWFdvP01UdU7gEErp/9MGAQ8/yYJhmJw301xvsQFoiPipjRYORa23vyY2AXvY4g t8sQ+iZ9xzWtiJwJBj9fPR164HPXdvTJfNMeXjHSPBQg0lCvuGN4Pwy6klw5Cv7CkfDy ynZjn3vBnm1t+UgR0NVklekVV1TGzONt6453nI+GyZUOwtktANkK5syfiPCga5nVal29 vNirnEP47S3e3Y/rgH/GUjm6w76MhiZt1F7XXFlzjUYsOdvI7xCfzsLEOsTnO/RrM8x7 afE7IHoiHHDOCdM8Sa70uDx7gYzdC8hWdCMPv9XnhxKeeZBALFa/3SlotA7Ulrk+PIkg bJOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=HkNjq3tbi8nKqX4IkjBTBaarkWNQpt4YH8j5X2iUamU=; b=NGFV0x1ciODCDJJmlQ91s5C5p8Kr8A128tn7TecXz7ssfzLO/nLuhqVspyS9cOBucx CIbR7tLQQKi8KfFKpAX5af8NIPFP423pJzJYqJ0PIdRk5bCgU/yjFGUwDvPE111wCCDR 6azMdKqx0OX1VylMcpVF+FeHVUSFYgqRImG9AqFfaUKv7cxNosc7iTqTjd+htDvgIWhy YenQrNUb5an0D5ZytE+l1PaBCBp5fnUMgvpl3FRA6JjNpAqHXvHLEQqMLxRpdUjR/1Yb XNTE67ZfPt8NmKWz8R1aHxXgMPxMIydRTWKClTtjHKMjDv/yCWalRCU8lI4MZG1/kFab GPFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=YBJXcTkx; 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 y23-v6si4580900pgc.515.2018.05.01.07.08.49; Tue, 01 May 2018 07:09:03 -0700 (PDT) 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=@nifty.com header.s=dec2015msa header.b=YBJXcTkx; 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 S1755912AbeEAOIZ (ORCPT + 99 others); Tue, 1 May 2018 10:08:25 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:17948 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755199AbeEAOIW (ORCPT ); Tue, 1 May 2018 10:08:22 -0400 Received: from mail-vk0-f53.google.com (mail-vk0-f53.google.com [209.85.213.53]) (authenticated) by conssluserg-05.nifty.com with ESMTP id w41E7q7x011885; Tue, 1 May 2018 23:07:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com w41E7q7x011885 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1525183673; bh=HkNjq3tbi8nKqX4IkjBTBaarkWNQpt4YH8j5X2iUamU=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=YBJXcTkxsadChqaX0VhQ9UhDCHI1gC5gnxa7ImNzN32ct+0GSTmm2Su3BTM7zTb3C ug7qO/GjOnRX70CmnFuTAHlDc240tPs2ZM0xVa51CHMICxaLxJVBw55X5kWAVjSo2a XoVwXkJQLvTiLU73Ff+w0KW+pc15e/JZopeGyAdyQJqDsUP1SnRiF3svZiYtaGCSKa nKTWZcGfrFqonBg9eAvdXwlQacuOZBEv/P98YiboC+Ql2+XDsYRVXg2LrnMhLEu6+q xSlEcwg2BRHH53PupUrbeVHzk0t35+R5mC6r1HdYqgry7iIUyd7rRKgVSza+1zFTXa gBtiKiQcKl5Hw== X-Nifty-SrcIP: [209.85.213.53] Received: by mail-vk0-f53.google.com with SMTP id x66-v6so2478426vka.11; Tue, 01 May 2018 07:07:53 -0700 (PDT) X-Gm-Message-State: ALQs6tCkW9BCPuxY+WQLY0nqM+VU5ggAWuA01SFs7FZL2iwSayPwge5v hAcfxxcyBxIZqorpbhACIKSRRp5Kd9FUBGaqGz8= X-Received: by 2002:a1f:808:: with SMTP id 8-v6mr13581770vki.166.1525183672165; Tue, 01 May 2018 07:07:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.85.216 with HTTP; Tue, 1 May 2018 07:07:11 -0700 (PDT) In-Reply-To: <1524135818-14825-2-git-send-email-yamada.masahiro@socionext.com> References: <1524135818-14825-1-git-send-email-yamada.masahiro@socionext.com> <1524135818-14825-2-git-send-email-yamada.masahiro@socionext.com> From: Masahiro Yamada Date: Tue, 1 May 2018 23:07:11 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] usb: dwc3: use local copy of resource to fix-up register offset To: linux-usb@vger.kernel.org, Felipe Balbi Cc: Rob Herring , Roger Quadros , Martin Blumenstingl , Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi , Masahiro Yamada , Greg Kroah-Hartman , Felipe Balbi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Felipe, 2018-04-19 20:03 GMT+09:00 Masahiro Yamada : > It is not a good idea to directly modify the resource of a platform > device. Modify its local copy, and pass it to devm_ioremap_resource() > so that we do not need to restore it in the failure path and the remove > hook. > > Signed-off-by: Masahiro Yamada > Reviewed-by: Masami Hiramatsu I want this patch applied first unless you are opposed to this clean-up. I'd like to avoid re-sending a trivial patch like this. > --- > > Changes in v2: None > > drivers/usb/dwc3/core.c | 32 ++++++++------------------------ > 1 file changed, 8 insertions(+), 24 deletions(-) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index a15648d..8e66edd 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -1245,7 +1245,7 @@ static void dwc3_check_params(struct dwc3 *dwc) > static int dwc3_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > - struct resource *res; > + struct resource *res, dwc_res; > struct dwc3 *dwc; > > int ret; > @@ -1270,20 +1270,19 @@ static int dwc3_probe(struct platform_device *pdev) > dwc->xhci_resources[0].flags = res->flags; > dwc->xhci_resources[0].name = res->name; > > - res->start += DWC3_GLOBALS_REGS_START; > - > /* > * Request memory region but exclude xHCI regs, > * since it will be requested by the xhci-plat driver. > */ > - regs = devm_ioremap_resource(dev, res); > - if (IS_ERR(regs)) { > - ret = PTR_ERR(regs); > - goto err0; > - } > + dwc_res = *res; > + dwc_res.start += DWC3_GLOBALS_REGS_START; > + > + regs = devm_ioremap_resource(dev, &dwc_res); > + if (IS_ERR(regs)) > + return PTR_ERR(regs); > > dwc->regs = regs; > - dwc->regs_size = resource_size(res); > + dwc->regs_size = resource_size(&dwc_res); > > dwc3_get_properties(dwc); > > @@ -1350,29 +1349,14 @@ static int dwc3_probe(struct platform_device *pdev) > pm_runtime_put_sync(&pdev->dev); > pm_runtime_disable(&pdev->dev); > > -err0: > - /* > - * restore res->start back to its original value so that, in case the > - * probe is deferred, we don't end up getting error in request the > - * memory region the next time probe is called. > - */ > - res->start -= DWC3_GLOBALS_REGS_START; > - > return ret; > } > > static int dwc3_remove(struct platform_device *pdev) > { > struct dwc3 *dwc = platform_get_drvdata(pdev); > - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > pm_runtime_get_sync(&pdev->dev); > - /* > - * restore res->start back to its original value so that, in case the > - * probe is deferred, we don't end up getting error in request the > - * memory region the next time probe is called. > - */ > - res->start -= DWC3_GLOBALS_REGS_START; > > dwc3_debugfs_exit(dwc); > dwc3_core_exit_mode(dwc); > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada