Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp563259rdh; Tue, 19 Dec 2023 07:10:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDc9tQse4a6aALxcfbih4iHvboBotc28T2cTGahjauIs5Tipzh9KA4b86niahL/PT1tfe1 X-Received: by 2002:a05:6808:3195:b0:3b9:f962:2b60 with SMTP id cd21-20020a056808319500b003b9f9622b60mr28157494oib.112.1702998612026; Tue, 19 Dec 2023 07:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702998611; cv=none; d=google.com; s=arc-20160816; b=VjBDaxoADKP2tcJLk2fcqAMSne3fVYgDWtkD6HZsXV6NUSY8zHInp5ybptdUAgXL3U AlyimvnC2n7xHRgt6pS0erCnBdr6u4JGzQQbqmExdmOxB2I/ZraDdanINfDk0ES7tPtf uYDEM6Uyn+OVWVV/6baMn3Itg6MpCSXWYGtkpOtIywjYYwznlXI0uq3SYWGXc5zAQnxP i6RQPTgKd1VIx5NeaMI20PzYFRuSiQlzUfO6k8MEyfPc4S/r+EvnL6s5smulqjz1Yoid 0uUeYSBbRJZ+RCFrLVqdTzz19dmESAquZVrCfsfoSNZrwbCVmRfG3Iz+tLVgxKa8PKzn 7c4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=P4oC4kvx6Hsk1LDXrBHCTiZQ1FcSUsCVKMMWR73G9Ig=; fh=8B3NYm4cY3Jfgrhmqnp/eS9NhmGphkHCj2/O0He0TCM=; b=XGAeQIKqg4W39BW8ZfPUsbN0rur/z9vcn4K8coBQK9XLsqRFtHB7n0pNON1o+D7Byo 4915nm89RfRjKrt+kcL75bsGkxlIbjCYtwYSU+elvX910nvLHHSt4HgGIgrlWERSiCmB jXIBEraEwXXLd06NdDVVzIgTb9FllAj54X9TY+yVw0Lm+kM1tjDPb3p9yJk30gagLVRq xoYCLkeD5wzOf/Lm1q4My8NPX7yX1t8/6BZ4VwO18AG0XRnx+n6WszJuz76XD3CjkrGe GkQfOIXDcG6no2VWjOK0/cRPxXtn/okGmEhPi87qR4G6jCTA2PIyF6sQVABectzlJIZl IYwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ytz86OmW; spf=pass (google.com: domain of linux-kernel+bounces-5457-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5457-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e12-20020a67eb8c000000b004668d120d5esi809874vso.826.2023.12.19.07.10.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 07:10:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5457-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ytz86OmW; spf=pass (google.com: domain of linux-kernel+bounces-5457-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5457-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 926461C20D07 for ; Tue, 19 Dec 2023 15:10:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCAC01D54B; Tue, 19 Dec 2023 15:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ytz86OmW" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A6811D529; Tue, 19 Dec 2023 15:10:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EE83C433C7; Tue, 19 Dec 2023 15:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702998604; bh=YG1opOXiv2eFAz9+JFxAGHHuQKweCGIP9rMOp7rwHcg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ytz86OmWaegIRsBA2unUSBkc6kLq8StD0r0jhGgzWrF62fM313/boELTJtKvyhIEw lUM+8Ys08phuamymX4VWV80dLjSxAcdwzA9pmiN8tt06HZKjCZ2PtmcYk+f7w2PAuA tYvdTOUZzBkoFpLy8HQaQukWkxcwslTBMJO5119s= Date: Tue, 19 Dec 2023 16:10:02 +0100 From: Greg Kroah-Hartman To: Marco Pagani Cc: Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org Subject: Re: [RFC PATCH v3 2/2] fpga: set owner of fpga_manager_ops for existing low-level modules Message-ID: <2023121924-extent-defender-fb06@gregkh> References: <20231218202809.84253-1-marpagan@redhat.com> <20231218202809.84253-3-marpagan@redhat.com> <2023121829-zealous-prissy-99cc@gregkh> <9296941c-a3c8-4d55-9e52-f1277f1c3fc7@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9296941c-a3c8-4d55-9e52-f1277f1c3fc7@redhat.com> On Tue, Dec 19, 2023 at 03:54:25PM +0100, Marco Pagani wrote: > > > On 2023-12-18 21:33, Greg Kroah-Hartman wrote: > > On Mon, Dec 18, 2023 at 09:28:09PM +0100, Marco Pagani wrote: > >> This patch tentatively set the owner field of fpga_manager_ops to > >> THIS_MODULE for existing fpga manager low-level control modules. > >> > >> Signed-off-by: Marco Pagani > >> --- > >> drivers/fpga/altera-cvp.c | 1 + > >> drivers/fpga/altera-pr-ip-core.c | 1 + > >> drivers/fpga/altera-ps-spi.c | 1 + > >> drivers/fpga/dfl-fme-mgr.c | 1 + > >> drivers/fpga/ice40-spi.c | 1 + > >> drivers/fpga/lattice-sysconfig.c | 1 + > >> drivers/fpga/machxo2-spi.c | 1 + > >> drivers/fpga/microchip-spi.c | 1 + > >> drivers/fpga/socfpga-a10.c | 1 + > >> drivers/fpga/socfpga.c | 1 + > >> drivers/fpga/stratix10-soc.c | 1 + > >> drivers/fpga/tests/fpga-mgr-test.c | 1 + > >> drivers/fpga/tests/fpga-region-test.c | 1 + > >> drivers/fpga/ts73xx-fpga.c | 1 + > >> drivers/fpga/versal-fpga.c | 1 + > >> drivers/fpga/xilinx-spi.c | 1 + > >> drivers/fpga/zynq-fpga.c | 1 + > >> drivers/fpga/zynqmp-fpga.c | 1 + > >> 18 files changed, 18 insertions(+) > >> > >> diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c > >> index 4ffb9da537d8..aeb913547dd8 100644 > >> --- a/drivers/fpga/altera-cvp.c > >> +++ b/drivers/fpga/altera-cvp.c > >> @@ -520,6 +520,7 @@ static const struct fpga_manager_ops altera_cvp_ops = { > >> .write_init = altera_cvp_write_init, > >> .write = altera_cvp_write, > >> .write_complete = altera_cvp_write_complete, > >> + .owner = THIS_MODULE, > > > > Note, this is not how to do this, force the compiler to set this for you > > automatically, otherwise everyone will always forget to do it. Look at > > how functions like usb_register_driver() works. > > > > Also, are you _sure_ that you need a module owner in this structure? I > > still don't know why... > > > > Do you mean moving the module owner field to the manager context and setting > it during registration with a helper macro? I mean set it during registration with a helper macro. > Something like: > > struct fpga_manager { > ... > struct module *owner; > }; > > #define fpga_mgr_register(parent, ...) \ > __fpga_mgr_register(parent,..., THIS_MODULE) > > struct fpga_manager * > __fpga_mgr_register(struct device *parent, ..., struct module *owner) > { > ... > mgr->owner = owner; > } Yes. But again, is a module owner even needed? I don't think you all have proven that yet... thanks, greg k-h