Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp501410ybk; Wed, 13 May 2020 05:51:04 -0700 (PDT) X-Google-Smtp-Source: APiQypL19znEQttIqlXqz904ezaQwU1RI92Bi/vUnQDHsGxFLkaIQllf/Y7wyL6p/L8KVT1T5e1i X-Received: by 2002:a17:906:860a:: with SMTP id o10mr14687591ejx.250.1589374263960; Wed, 13 May 2020 05:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589374263; cv=none; d=google.com; s=arc-20160816; b=CFIfJ0+utDLf3efWSWyMwsPubSpT5ddzMQNraaqwt1cjOSadM2xzndPweR3QUrY/a9 bInTCDfQ7VY7TpkSBV8fKJyGH+p2fL0RMbDr5RUcvaJ6PCrQV9mmJqqjo3pB79smPhfH +fQguhhQTVpZeU+rn8HNs6n/+GPrrDP27/PMsVhSYVKkA7Tn87qUz6/IK6UXD5EzrJu5 ZUgFSmAf0UcZW1nsGV1O5KsU2Abese1d4Tl1W4KZ+HHcq5pAiMIohWqUh2lduTd+XylH lMIrId03+OPYBoyU+0zq2PmMPB4j8K0UffzKG6F17eAbPN8Kitbd4BcQnrbV9kQOJY0O /otg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=BqOPKVvA2cD6o00Zouzk7qhkZ7i8uvE0HYJVIxO8GSk=; b=gj/Hhxe00JWnP8GzRUx2HB1Er93dorvTCSdUq3BmkJdG6PjKFtUbcp+4HpqXD/VBzS a2z/9zJX/nyp7zbX+ep9rqh5Cj9PLfrLwwVh4i7DxbeOp/06VjW3tKuCSknao85UjXQ/ jW3dJwngTAL6EL7Q+87hJ0jnjtFUghwJKIKBGui1wEk0HrXuJgMVvU+U4cEAELfwVm9J x2VoSH+IvYH6NHwRbR1WRfu7udpx69zufvnAts8o7ckZXQlzmEkB6X0cK6VNAmHAelDz 9MCN6tcZQRzGV9GQYxKOn8NAFQ1jMWO68o3R+09APb7ds5wqoR8T1q3f0NfPKJF6289/ vhlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="m5w/tJOE"; 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 d9si5665052ejb.393.2020.05.13.05.50.39; Wed, 13 May 2020 05:51:03 -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; dkim=pass header.i=@kernel.org header.s=default header.b="m5w/tJOE"; 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 S1732967AbgEMMqB (ORCPT + 99 others); Wed, 13 May 2020 08:46:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:46794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728547AbgEMMp5 (ORCPT ); Wed, 13 May 2020 08:45:57 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 73F7D20659; Wed, 13 May 2020 12:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589373956; bh=sk6047XT6X0SHxwSg7uWkaiZItlOEgHsYjkCMM6vFnc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m5w/tJOE5gNJFaF2gW0Ahk648XGhN+W9Ttl5IkViOG9E/oQfNL96pbNlDEQdXUFJI p7cU7saq+S6QDR9MultHEj3steJD3ta3R0va761iRDxQ6pf0N9dqySKqfytbZ/oUIi SlqWIptN4tWvOpTcG23wf6WIipom3qj9hhjw3H4g= Date: Wed, 13 May 2020 14:45:54 +0200 From: Greg Kroah-Hartman To: Mathias Nyman Cc: Vinod Koul , Mathias Nyman , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Yoshihiro Shimoda , Christian Lamparter , John Stultz , Alan Stern , Andreas =?iso-8859-1?Q?B=F6hler?= , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v13 5/5] usb: xhci: provide a debugfs hook for erasing rom Message-ID: <20200513124554.GA1083139@kroah.com> References: <20200506060025.1535960-1-vkoul@kernel.org> <20200506060025.1535960-6-vkoul@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 13, 2020 at 03:36:19PM +0300, Mathias Nyman wrote: > On 6.5.2020 9.00, Vinod Koul wrote: > > run "echo 1 > /sys/kernel/debug/renesas-usb/rom_erase" to erase > > firmware when driver is loaded. > > > > Subsequent init of driver shall reload the firmware > > > > Signed-off-by: Vinod Koul > > --- > > drivers/usb/host/xhci-pci-renesas.c | 33 +++++++++++++++++++++++++++++ > > 1 file changed, 33 insertions(+) > > > > diff --git a/drivers/usb/host/xhci-pci-renesas.c b/drivers/usb/host/xhci-pci-renesas.c > > index f7d2445d30ec..fa32ec352dc8 100644 > > --- a/drivers/usb/host/xhci-pci-renesas.c > > +++ b/drivers/usb/host/xhci-pci-renesas.c > > @@ -2,6 +2,7 @@ > > /* Copyright (C) 2019-2020 Linaro Limited */ > > > > #include > > +#include > > #include > > #include > > #include > > @@ -170,6 +171,8 @@ static int renesas_fw_verify(const void *fw_data, > > return 0; > > } > > > > +static void debugfs_init(struct pci_dev *pdev); > > + > > static bool renesas_check_rom(struct pci_dev *pdev) > > { > > u16 rom_status; > > @@ -183,6 +186,7 @@ static bool renesas_check_rom(struct pci_dev *pdev) > > rom_status &= RENESAS_ROM_STATUS_ROM_EXISTS; > > if (rom_status) { > > dev_dbg(&pdev->dev, "External ROM exists\n"); > > + debugfs_init(pdev); > > return true; /* External ROM exists */ > > } > > > > @@ -449,6 +453,34 @@ static void renesas_rom_erase(struct pci_dev *pdev) > > dev_dbg(&pdev->dev, "ROM Erase... Done success\n"); > > } > > > > +static int debugfs_rom_erase(void *data, u64 value) > > +{ > > + struct pci_dev *pdev = data; > > + > > + if (value == 1) { > > + dev_dbg(&pdev->dev, "Userspace requested ROM erase\n"); > > + renesas_rom_erase(pdev); > > + return 0; > > + } > > + return -EINVAL; > > +} > > +DEFINE_DEBUGFS_ATTRIBUTE(rom_erase_ops, NULL, debugfs_rom_erase, "%llu\n"); > > + > > +static struct dentry *debugfs_root; > > + > > +static void debugfs_init(struct pci_dev *pdev) > > +{ > > + debugfs_root = debugfs_create_dir("renesas_usb", NULL); > > This will create a renesas_usb directory right under debugfs root. > xhci has its own struct dentry xhci_debugfs_root; > Use that as parent instead Ah, I misssed that, a follow-on patch can do this, right? > Also note that debugs_create_dir() can fail, for example if debugfs isn't supported. Doesn't matter, never check the result, just move on and all is fine :) This logic is correct, no need for it to be changed. thanks, greg k-h