From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6704C77B7A for ; Mon, 29 May 2023 09:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231779AbjE2JJ5 (ORCPT ); Mon, 29 May 2023 05:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbjE2JJq (ORCPT ); Mon, 29 May 2023 05:09:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 469529C; Mon, 29 May 2023 02:09:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D065361239; Mon, 29 May 2023 09:09:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 349B0C433D2; Mon, 29 May 2023 09:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685351384; bh=dW8HaUANnD0KpZnNdrw8u54SlE9A4EhFPiSPNCIaXkc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZBxiEkG3dS0o9jaQ/RLwikydt5DUrFAy0GJb6/BlTzGD+IRYhNHOKpfXMRcuPG7Co 8tfqxjbCPUY/c9NR+XcbCgs4iKvE7nxpbEOxPIL0171ugWn8Wz2enFqEvToTVpyPtH lfIonYn4nE7TDzfQ7fOlPJn+nVZUy512ZfRCAaBqajFqj2Bd5BIqD9wi7FG78DzXsV ycMD9ZMQ1U7MVgmv9eX4c+veCYn0Qhxaf9E6+X1fU/Qvhcbfy0onUprtxGO9OY4WgL FJubOLQmodWNddfZpb7zfCMNpBDNjTFzRy1ydc2sZoDGOOanYdQOqUb8w1m8HGmfID 76fKRV4hZ/Sgg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1q3Ysn-0012B5-Rv; Mon, 29 May 2023 10:09:41 +0100 Date: Mon, 29 May 2023 10:09:41 +0100 Message-ID: <86bki3cxm2.wl-maz@kernel.org> From: Marc Zyngier To: Biju Das Cc: Laurent Pinchart , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , Zheng Wang , Geert Uytterhoeven , Yoshihiro Shimoda , Wolfram Sang , Krzysztof Kozlowski , "linux-usb@vger.kernel.org" , Prabhakar Mahadev Lad , "linux-renesas-soc@vger.kernel.org" Subject: Re: [PATCH] usb: gadget: udc: renesas_usb3: Fix RZ/V2M {modprobe,bind} error In-Reply-To: References: <20230526143615.372338-1-biju.das.jz@bp.renesas.com> <20230529061714.GA25984@pendragon.ideasonboard.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: biju.das.jz@bp.renesas.com, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, zyytlz.wz@163.com, geert+renesas@glider.be, yoshihiro.shimoda.uh@renesas.com, wsa+renesas@sang-engineering.com, krzysztof.kozlowski@linaro.org, linux-usb@vger.kernel.org, prabhakar.mahadev-lad.rj@bp.renesas.com, linux-renesas-soc@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 29 May 2023 09:42:34 +0100, Biju Das wrote: > > Hi Laurent, > > Thanks for the feedback. > > > Subject: Re: [PATCH] usb: gadget: udc: renesas_usb3: Fix RZ/V2M > > {modprobe,bind} error > > > > Hi Biju, > > > > Thank you for the patch. > > > > On Fri, May 26, 2023 at 03:36:15PM +0100, Biju Das wrote: > > > Currently {modprobe, bind} after {rmmod, unbind} results in probe > > failure. > > > > > > genirq: Flags mismatch irq 22. 00000004 (85070400.usb3drd) vs. > > > 00000004 (85070400.usb3drd) > > > renesas_usb3: probe of 85070000.usb3peri failed with error -16 > > > > > > Fix this issue by replacing "parent dev"->"dev" as the irq resource is > > > managed by this driver. > > > > If the dev pointer passed to devm_request_irq() is not the correct one, > > how does it work the first time the driver is loaded ? > > + Marc/ Kernel.org to give some feedback on this issue > > I believe there may be a bug in the genirq (kernel/irq) driver. > first time it works ok. Maybe this driver is caching on unload > with null value and comparing with actual one (irq 22) during reload?? > > Maybe genirq expert can comment what went wrong here?? You get shouted at because you are registering an interrupt handler for the same IRQ twice, and the interrupt is not configured with the SHARED flag. If, as I understand it, you only have a single device using this interrupt, then it means your driver is not freeing its interrupt on unload. And that's probably because the device object used when requesting the interrupt isn't the one you load/unload, as indicated by the message. On the first load of "usb3peri", you register an interrupt with "usb3drd" as the requester device. You then unload "usb3peri", which of course has no effect whatsoever on the interrupt. You could simply have done a "cat /proc/interrupt" and see that interrupt was still there after unload. So the only bug here is in the handling of the interrupt request. And that bug firmly lies in your code. My "expert" advise is to debug the problem rather than suspecting some random failure modes. Thanks, M. -- Without deviation from the norm, progress is not possible.