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.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 33FE4C47095 for ; Mon, 7 Jun 2021 22:36:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04713610E7 for ; Mon, 7 Jun 2021 22:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbhFGWiJ (ORCPT ); Mon, 7 Jun 2021 18:38:09 -0400 Received: from mail-pg1-f181.google.com ([209.85.215.181]:36384 "EHLO mail-pg1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbhFGWiJ (ORCPT ); Mon, 7 Jun 2021 18:38:09 -0400 Received: by mail-pg1-f181.google.com with SMTP id 27so14981369pgy.3; Mon, 07 Jun 2021 15:36:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hKhaqCYL8rUWPELYhzsx9BmSwN7L4y5O/8Q3uwiaxlA=; b=cCclyaDuIk7Qc0i/e/Qf8bCMg0enIVCSWJgsZ89H09UEUtmhJffIR6VmyC++N/WOLc GA5Sitq1kljnykdcco7p9cYfjwg2YQA5TWRWmelrue6HMGBTpWf/OE3o/ARxl8Syv+AK xehgRupfv2c4qv4n9g88q7q+ZRblpohDvjO+r9MDvAcLB3FaRjn+AsWadfiNbZNJge54 MURI1Vk9bczbBLSKa0DCOLd+lpEhB7rpDEPfMsCXWXCnJRJ1v/l3RQHqCfEYlwtOhYmN fMiFNKBoBMrbHxAmISRuRnWlqp4vNAct/LwMqws9JSxh4nys/4/ZqXjY2srOfwID4rTj o6Sw== X-Gm-Message-State: AOAM532sa4B/5GeWmPrtx5qXN8BTGiToEaz9nwAjkyvfHuL47XDXuxzE OHFMwI1Ki08tRRUuPeCfaZk= X-Google-Smtp-Source: ABdhPJy/se9L/IQnWLJFUkwmoQhe3Sb8IW9LybQRwl+6bB4lqm3qHNg7etZG3QTmvV4OHCaQbBzvWw== X-Received: by 2002:a05:6a00:26d8:b029:2ea:1101:8acf with SMTP id p24-20020a056a0026d8b02902ea11018acfmr18694951pfw.67.1623105363086; Mon, 07 Jun 2021 15:36:03 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id p20sm8847268pff.204.2021.06.07.15.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 15:36:02 -0700 (PDT) Date: Mon, 7 Jun 2021 15:36:01 -0700 From: Moritz Fischer 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 1/7] fpga: wrap the write_init() op Message-ID: References: <20210607172402.2938697-1-trix@redhat.com> <20210607172402.2938697-2-trix@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210607172402.2938697-2-trix@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org On Mon, Jun 07, 2021 at 10:23:56AM -0700, trix@redhat.com wrote: > From: Tom Rix > > The board should not be required to provide a Nit: Can you turn these into for whole series: A FPGA Manager should not be ... > 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 b85bc47c91a9..24547e36a56d 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) > + 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 *dev, 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(dev, "Attempt to register without fpga_manager_ops\n"); > return NULL; > -- > 2.26.3 > Can you change the subjects to "fpga: fpga-mgr: ..." Otherwise series looks good. - Moritz 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.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 262BBC47082 for ; Mon, 7 Jun 2021 22:40:22 +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 D038561073 for ; Mon, 7 Jun 2021 22:40:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D038561073 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=TzOmiMEuW2t2eXQoVJQYYI74x/AlYCRxgxOYQcDHdkE=; b=hiM+VuuNf9OYjK bcsyTW26JpRiH8bC16KA1C5Q6UOqiDvYxC2ocScRhYC9joFX4+TX8TqFJrX1lRw0sg3Qbh6fze419 GQ78Ao5suIQ6jGtio5vV2HZVvsn+GOWXZC5I4ltO1RAX4l868BS4c5O7B7pWRS2OYLKUptwnP5rUA 0tCcOQ0eQO2cRUAKhbq6lBVfXoud80XNN/h0cwWtXNA/2hn5lCVkdU6RdWHhvwM/MF1Mng+lKpqGE XW98QOU3LiB5XBCWVIeb/vx5YW8bEC2IXPq69cnN2eouVOrhy/sFhPgPfI6PwhCbxNjlp1yeBeeJP JUD+AqwA1SInYs08V0RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqNqs-005aQv-MI; Mon, 07 Jun 2021 22:36:10 +0000 Received: from mail-pf1-f174.google.com ([209.85.210.174]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqNql-005aQO-V8 for linux-arm-kernel@lists.infradead.org; Mon, 07 Jun 2021 22:36:08 +0000 Received: by mail-pf1-f174.google.com with SMTP id y15so14192806pfl.4 for ; Mon, 07 Jun 2021 15:36:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hKhaqCYL8rUWPELYhzsx9BmSwN7L4y5O/8Q3uwiaxlA=; b=YJjVOb1rbZ0wR1LrUC6bntNIV+sXSXqbeZcjBl5bOqDMkLhdumLxc2DwaiRf3Miaw8 zKAHBEi3DIvt8G1A7Pj1PV4bch+zMthK8Tc1bSv73OEBYAJdPCXmXCTfav6n9hmIDWEk XW7AwxaZSzaxTSZ00dcoRGkzoFcI0wXW5sd/8eSzX447AYuDsASF4GP1z3RaFS3QJWJD FjQKiBMPht9vCiuKyPMnSTO713xaB086NLh47i10W6CICoKAXtx6AvAyk5qqOLloQ/E0 Sx5aA+qIYjR5wxJ5dweVMt6tH8SXz3HOIxeotNrKQRiQhTjD7GLWpk6JxTCyssr84g/v +wtQ== X-Gm-Message-State: AOAM531qtUqYMDhihbqURHqSfR2PwQ5Qa7YtD15TdVnKp+RuOiw1tcjg IqOyAc76b+te3EjMzmlBOGI= X-Google-Smtp-Source: ABdhPJy/se9L/IQnWLJFUkwmoQhe3Sb8IW9LybQRwl+6bB4lqm3qHNg7etZG3QTmvV4OHCaQbBzvWw== X-Received: by 2002:a05:6a00:26d8:b029:2ea:1101:8acf with SMTP id p24-20020a056a0026d8b02902ea11018acfmr18694951pfw.67.1623105363086; Mon, 07 Jun 2021 15:36:03 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id p20sm8847268pff.204.2021.06.07.15.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 15:36:02 -0700 (PDT) Date: Mon, 7 Jun 2021 15:36:01 -0700 From: Moritz Fischer 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 1/7] fpga: wrap the write_init() op Message-ID: References: <20210607172402.2938697-1-trix@redhat.com> <20210607172402.2938697-2-trix@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210607172402.2938697-2-trix@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210607_153604_030969_13D77DBE X-CRM114-Status: GOOD ( 25.78 ) 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 Mon, Jun 07, 2021 at 10:23:56AM -0700, trix@redhat.com wrote: > From: Tom Rix > > The board should not be required to provide a Nit: Can you turn these into for whole series: A FPGA Manager should not be ... > 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 b85bc47c91a9..24547e36a56d 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) > + 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 *dev, 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(dev, "Attempt to register without fpga_manager_ops\n"); > return NULL; > -- > 2.26.3 > Can you change the subjects to "fpga: fpga-mgr: ..." Otherwise series looks good. - Moritz _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel