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 X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB060C48BDF for ; Thu, 24 Jun 2021 08:01:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79E0B613C1 for ; Thu, 24 Jun 2021 08:01:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79E0B613C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hk+QA40ZS75YAE3x0ce5RTACYrZgTm1bSHpapzY+tJw=; b=Oy4oh3zQn/DKEV ICg3GlIZ0mOqf5cixD6I1LehD4XU7T6nLfHYoF7rvPg/XIgbiWP8NAUJYOxyeu/zr6SBQSBYmQA5v kMEwEf0vBHWULvD5Ub9CUEl1RkXaqN8SbGyBWl59vGTKsKTnBWbbPfbcMARHRmGQXmbf/ZuhFq5aU Qilu7sCLUNi8WQGtC0UwqXoUk1HoFQKhQDRtA1K3pWBdHpdqAIRv6sxT/iNwwNZvhJI1TI0mZm0BM UmuCzn9Alv7014s0NEQDoB1VdBl7R3tgIibC9jybukdMtLedwNGhJH9xkf28SIzKERuLNX9MsjwYG Oye2nHX0eUe9r8gRCk3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwKGx-00DL0v-5c; Thu, 24 Jun 2021 07:59:39 +0000 Received: from mga06.intel.com ([134.134.136.31]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwKGt-00DL09-Di for linux-arm-kernel@lists.infradead.org; Thu, 24 Jun 2021 07:59:36 +0000 IronPort-SDR: nybImd4coK3+13sW7Nr/8RJF+/Lcv8SKFjfekWmV0KIbsDPDYTjVsU2NLbAAXJdbEYgWmD5I0A jh8+DNLEPB7A== X-IronPort-AV: E=McAfee;i="6200,9189,10024"; a="268555462" X-IronPort-AV: E=Sophos;i="5.83,296,1616482800"; d="scan'208";a="268555462" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2021 00:59:31 -0700 IronPort-SDR: 9rrIp9l+o5YU/gZbNNmGk1pTfaV91pCI7CzngOK5/quyOfaBZ+JjbMuY1JCYe2jLtrc3uYBsBu /jGvwOe8AXHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,296,1616482800"; d="scan'208";a="557249382" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.162]) by fmsmga001.fm.intel.com with ESMTP; 24 Jun 2021 00:59:28 -0700 Date: Thu, 24 Jun 2021 15:54:14 +0800 From: Xu Yilun To: trix@redhat.com Cc: hao.wu@intel.com, mdf@kernel.org, michal.simek@xilinx.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 1/7] fpga-mgr: wrap the write_init() op Message-ID: <20210624075414.GA44700@yilunxu-OptiPlex-7050> References: <20210623182410.3787784-1-trix@redhat.com> <20210623182410.3787784-3-trix@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210623182410.3787784-3-trix@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_005935_543838_BBD2151F X-CRM114-Status: GOOD ( 23.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 23, 2021 at 11:24:04AM -0700, trix@redhat.com wrote: > From: Tom Rix > > An FPGA manager should not be required to provide a > write_init() op if there is nothing for it do. > So add a wrapper and move the op checking. > Default to success. > > Signed-off-by: Tom Rix > --- > drivers/fpga/fpga-mgr.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c > index ecb4c3c795fa5..87bbb940c9504 100644 > --- a/drivers/fpga/fpga-mgr.c > +++ b/drivers/fpga/fpga-mgr.c > @@ -69,6 +69,14 @@ void fpga_image_info_free(struct fpga_image_info *info) > } > EXPORT_SYMBOL_GPL(fpga_image_info_free); > > +static int fpga_mgr_write_init(struct fpga_manager *mgr, > + struct fpga_image_info *info, > + const char *buf, size_t count) > +{ > + if (mgr->mops && mgr->mops->write_init) Maybe we don't have to check mgr->mops, it is already checked on creation. The same concern to all the following patches. Thanks, Yilun > + return mgr->mops->write_init(mgr, info, buf, count); > + return 0; > +} > /* > * Call the low level driver's write_init function. This will do the > * device-specific things to get the FPGA into the state where it is ready to > @@ -83,9 +91,9 @@ static int fpga_mgr_write_init_buf(struct fpga_manager *mgr, > > mgr->state = FPGA_MGR_STATE_WRITE_INIT; > if (!mgr->mops->initial_header_size) > - ret = mgr->mops->write_init(mgr, info, NULL, 0); > + ret = fpga_mgr_write_init(mgr, info, NULL, 0); > else > - ret = mgr->mops->write_init( > + ret = fpga_mgr_write_init( > mgr, info, buf, min(mgr->mops->initial_header_size, count)); > > if (ret) { > @@ -569,7 +577,7 @@ struct fpga_manager *fpga_mgr_create(struct device *parent, const char *name, > int id, ret; > > if (!mops || !mops->write_complete || !mops->state || > - !mops->write_init || (!mops->write && !mops->write_sg) || > + (!mops->write && !mops->write_sg) || > (mops->write && mops->write_sg)) { > dev_err(parent, "Attempt to register without fpga_manager_ops\n"); > return NULL; > -- > 2.26.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel