Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp294833lqp; Fri, 12 Apr 2024 19:41:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLOaVLUgxJy+2+X8N3DUOxIFQONoZJkostD9vcL69gt1VwLHtj7njzExBKgjL05eFX6wc8CrDMmLZV/t0EhjFCnkyaUTU9BTcZsYGfow== X-Google-Smtp-Source: AGHT+IFD6cki/t93H17yVG+Ya+JUWdCL4jxb+fhZBQWq66nHEO3t/WCxAxw+evT3pUuJ6aBxgrjo X-Received: by 2002:a54:470c:0:b0:3c5:e025:42f4 with SMTP id k12-20020a54470c000000b003c5e02542f4mr4335254oik.15.1712976075137; Fri, 12 Apr 2024 19:41:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712976075; cv=pass; d=google.com; s=arc-20160816; b=opgklJJ0sxEDnrTNfgyQODIzKDgtRec7zS0cX+3ZFpxvJQKmmhAbOf8ODxHRDHmB3U fVQ6ElJ+EVRpya27nXFfszWNkZf2Elj9HE0dH8phT4KXLHfEGZ7tb1fZqP+5LdS/UBoM U/8nA9y49avOmC1gLCFkqlEvnxDzG19tKzA35rWoHpj7LKe02kpKw4VJmSLa9hK9AAFt 8QN9y0Kdp7XT9xS6mlle8EP6PhC+G865+Wwf7byavPBZ/3BkMAP9jThGbmTGGpfmG3CL L+K1QA9m6CS2DHiHQhg2UcMibri8+cNHB+bQChfVl++A6bQtsZFAuXwamo3SJetc1pe/ G5mw== ARC-Message-Signature: i=2; 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=/jn/QDnXkmj/nDsYnIXFsyEREcEszWL7+bciA2d8tok=; fh=9RvofxN2HDhir9caJGvN6UMPCGNY8DPeIfwy+sOZG4c=; b=jCP94P55wn6PkJNp8pUB892ETuDgmzhwZ5/poEYHQrJzHfWAVuxCCacHDGxer8lb4c Qd2N53edmLAM38SiLg7amuAXVJpuMUxhCK5mhpPNEM5fScFwW7SLdboIq/3A8skDRRS5 gklm+DrJOWjGgC4EZHlDp+kg/LZBRrsY/20hdokz4NVpp/LizTj8h87/TLWtTTJRnEXo jup0WKNVGnay6QGZ3pYP7fhr6r+WsSolOJy+F+cva3bRrpx4z0degRkO9L0yTLQBPYP4 XbvRWW+juLLOYLkZHQ6guV8DCVMTZSiH1+wmCf4MsY2He8sErRxRddCUM5llrz5jku7Q MhNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Df2AIMIR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-143526-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143526-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e17-20020a63db11000000b005dc9a3fa409si4218740pgg.197.2024.04.12.19.41.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 19:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143526-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Df2AIMIR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-143526-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143526-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C980C28494C for ; Sat, 13 Apr 2024 02:41:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B276318059; Sat, 13 Apr 2024 02:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Df2AIMIR" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 99D3C8C1A; Sat, 13 Apr 2024 02:41:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712976067; cv=none; b=gsEkCAMLDbtvp/TGZ1nAkglV/YD7qmm2pmNw5u+1YuegjW94BUJEtHCuZVfwl4vn54sEVmnNjstiSZZmgo5MwcTvg07ubaUs7+gPLycyELTFmZBvsqny/R38dZVofxol5frYEAi1upX5I1x0R6CV9hvyMsOJ7cRaV+u2mnxWGv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712976067; c=relaxed/simple; bh=axMJ7bTjXsx72XR3DZUHb3cgP4ohIiTGFHZNUvsGHSM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jQ3KojnobEVlPE/jXwFAM04Yjdrsc9N8UjA0mwtCS4KS2A2cQj5N125qEVAuArx/5YVAmEj4SIC8nguboe5eZnQ2Qc9CAE0hzqzhOKwpo1uWbAQrT49W1vXdgjaYBpPQc+DqHJehqvjOsS+tEOMUdDjGOA3BgpFvh1QRmzP0cgs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Df2AIMIR; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712976064; x=1744512064; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=axMJ7bTjXsx72XR3DZUHb3cgP4ohIiTGFHZNUvsGHSM=; b=Df2AIMIRIZeaVZ5zzK2Z2mwbcHaiFDBbzztL7XAMOZ2B0MMmMeDsMuOb LrG6awYWZ/6YJCEiTSZsMdxUqyjAkdG9y4rTgwZhS0+NIT9oH7XB9jziK 1o+Aekr8Ebf/fNKXRA/oA8juDwDSD1n4FQY1KzHssYzBjkwXBeTkQtTE1 +anrLRBq7wooqymQNdZWLqU9xsXbidCrPlF3zGPWjuCpOR64Xn1ra5vmc TGOrhlL5JduN93dL0xVtlxZ1O01RNRTYZqBRsfIgkII/uymcPWqEttKc2 v9j5KnZmsBBnxxi7Vl5kqHNUarBUT7rkijDdS0I0HJjbVZ6vC9wYvkoqK Q==; X-CSE-ConnectionGUID: Q1dPpqK0QRKuJoogrKWZ3A== X-CSE-MsgGUID: ImpDt05nSNKTELzT+qECAw== X-IronPort-AV: E=McAfee;i="6600,9927,11042"; a="19839619" X-IronPort-AV: E=Sophos;i="6.07,198,1708416000"; d="scan'208";a="19839619" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 19:41:03 -0700 X-CSE-ConnectionGUID: NNm7cw+nRwaDjs5oPjLO2Q== X-CSE-MsgGUID: y5xzLG7qRymsgK360LjoVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,198,1708416000"; d="scan'208";a="52353158" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by orviesa002.jf.intel.com with ESMTP; 12 Apr 2024 19:40:59 -0700 Date: Sat, 13 Apr 2024 10:35:53 +0800 From: Xu Yilun To: Marco Pagani Cc: Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , Jonathan Corbet , Greg Kroah-Hartman , Alan Tull , Russ Weight , linux-fpga@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5] fpga: region: add owner module and take its refcount Message-ID: References: <20240411144811.121500-1-marpagan@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: <20240411144811.121500-1-marpagan@redhat.com> > /** > - * fpga_region_register_full - create and register an FPGA Region device > + * __fpga_region_register_full - create and register an FPGA Region device > * @parent: device parent > * @info: parameters for FPGA Region > + * @owner: owner module containing the get_bridges function This is too specific and easily get unaligned if we add another callback. How about "module containing the region ops"? > * > * Return: struct fpga_region or ERR_PTR() > */ > struct fpga_region * > -fpga_region_register_full(struct device *parent, const struct fpga_region_info *info) > +__fpga_region_register_full(struct device *parent, const struct fpga_region_info *info, > + struct module *owner) > { > struct fpga_region *region; > int id, ret = 0; > @@ -213,6 +215,7 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info * > region->compat_id = info->compat_id; > region->priv = info->priv; > region->get_bridges = info->get_bridges; > + region->ops_owner = owner; > > mutex_init(®ion->mutex); > INIT_LIST_HEAD(®ion->bridge_list); > @@ -241,13 +244,14 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info * > > return ERR_PTR(ret); > } > -EXPORT_SYMBOL_GPL(fpga_region_register_full); > +EXPORT_SYMBOL_GPL(__fpga_region_register_full); > > /** > - * fpga_region_register - create and register an FPGA Region device > + * __fpga_region_register - create and register an FPGA Region device > * @parent: device parent > * @mgr: manager that programs this region > * @get_bridges: optional function to get bridges to a list > + * @owner: owner module containing get_bridges function ditto > * > * This simple version of the register function should be sufficient for most users. > * The fpga_region_register_full() function is available for users that need to > @@ -256,17 +260,17 @@ EXPORT_SYMBOL_GPL(fpga_region_register_full); > * Return: struct fpga_region or ERR_PTR() > */ > struct fpga_region * > -fpga_region_register(struct device *parent, struct fpga_manager *mgr, > - int (*get_bridges)(struct fpga_region *)) > +__fpga_region_register(struct device *parent, struct fpga_manager *mgr, > + int (*get_bridges)(struct fpga_region *), struct module *owner) > { > struct fpga_region_info info = { 0 }; > > info.mgr = mgr; > info.get_bridges = get_bridges; > > - return fpga_region_register_full(parent, &info); > + return __fpga_region_register_full(parent, &info, owner); > } > -EXPORT_SYMBOL_GPL(fpga_region_register); > +EXPORT_SYMBOL_GPL(__fpga_region_register); > > /** > * fpga_region_unregister - unregister an FPGA region > diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h > index 9d4d32909340..5fbc05fe70a6 100644 > --- a/include/linux/fpga/fpga-region.h > +++ b/include/linux/fpga/fpga-region.h > @@ -36,6 +36,7 @@ struct fpga_region_info { > * @mgr: FPGA manager > * @info: FPGA image info > * @compat_id: FPGA region id for compatibility check. > + * @ops_owner: module containing the get_bridges function ditto Thanks, Yilun > * @priv: private data > * @get_bridges: optional function to get bridges to a list > */ > @@ -46,6 +47,7 @@ struct fpga_region { > struct fpga_manager *mgr; > struct fpga_image_info *info; > struct fpga_compat_id *compat_id; > + struct module *ops_owner; > void *priv; > int (*get_bridges)(struct fpga_region *region); > };