From patchwork Wed Jun 23 18:24:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 12340311 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=-17.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,USER_AGENT_GIT 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 8CC9DC4743C for ; Wed, 23 Jun 2021 18:27:14 +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 58B2661164 for ; Wed, 23 Jun 2021 18:27:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58B2661164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e73Dp11z6NlJaL+U4kmzAP9CB3hTYkiktK7BVwz7EK0=; b=gYLIfBCDEuos6p gsHtLj614PQzle8i2t40TJnYz9gXx7AjMlUFkPihDuR135R84VLFQKyuCGw+CWBS8h1Hm2rRqW6i1 dNCfJ8wf8rnl2N92uB+8/7g/a38aoKOKzFLFZ8z2H1BDPhfRqBbbPfGDXKeSIGZrGF5Oyyoo9lkVr iVQyUGsgu2g1d7zIy0R3yzpqOKXf8GJF3bEIkhlFatB8nP9YBtyi/zlgWn4shIAckk/z5TYtIfLy/ 4ftEkK5hxtf/QfCPJ/Nv5W/8jD7yDs2TL64A68zlxoP333h9904dmni0p0PwrhF/Hz5DcggJEerAt uqfUpIbYfy9roZobXlGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lw7YR-00BcG8-91; Wed, 23 Jun 2021 18:24:51 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lw7Y9-00BcAf-VJ for linux-arm-kernel@lists.infradead.org; Wed, 23 Jun 2021 18:24:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624472673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5PxTldx17CDNKsCv+3pIoboW0CCoBJIoZzyWzxD7ju4=; b=ZFBhXVkNpgRjogI68Z7NDje52Aet8+ALYf+8RARgT6xwu3TIb+eYfHvvlkhmAOIgSwZkhU sQH9t/4kVTtwaCIlM2SkRYKqLgtHJMCjRh+ThE3yjXbot0+q7PWhJK6ybhiBqMRTPepELe 8Cupejh1GNnZz4CvP1+XZlYQA3780Zc= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-122-D0R4Pxm1NXOQjF3UXq_mVA-1; Wed, 23 Jun 2021 14:24:29 -0400 X-MC-Unique: D0R4Pxm1NXOQjF3UXq_mVA-1 Received: by mail-ot1-f72.google.com with SMTP id 59-20020a9d0dc10000b02902a57e382ca1so1818925ots.7 for ; Wed, 23 Jun 2021 11:24:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5PxTldx17CDNKsCv+3pIoboW0CCoBJIoZzyWzxD7ju4=; b=nijJbB0+EBBJG9dGSOnHLFYZlT9ErmH1v8Fl2oIXACJ71gMhNqrAnwTRncc8GwNegc c92pMIqmG2ANaTJBc7zcS8KOemkK8TQWAhSD6RIVh3/JalZt6QBmVn8DP8/n4j0Vhzyj 4qoWfUmVyIaaWYCs9s9sabCm6DibwFDsiG/nZODgn2WYQSrOgSsyc3kJ1ljhCSqlR0xq 6GUUzP+FXVzvobhW14CyVVWkU+JDC+eetpfoKCcDpgB2KP5RtKEUF5dT2Ss+4d9W9Dfd WLkN9sAgHXzIXz/pzPr4lwrurzuTZqo+OguwVUwEt3O7aKh+IvIVdj2VMjoOj7gWjk/M IKwg== X-Gm-Message-State: AOAM531zbHma4ZQAGf/GZIanzrSQ+HvXoufu2EZZwwgq+0ZzqSlIX9xu dHwZInQkTYwGwwroldhSdjFuVQVb0T08qwPpD9wRE6N8DqzJdXDtvuof53npUma3Az82S3ZxLmv OSBewBQ7tJkrgfvRk4aK/Naz6BkDLYn5eIYU= X-Received: by 2002:a9d:6508:: with SMTP id i8mr1032026otl.368.1624472668642; Wed, 23 Jun 2021 11:24:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCRjF7FYY/2Pj0Mk+PNxI071W5obXDGwdzCI4+olhtl6o/gohgN6WImevV4bHQSOtf0rG6uA== X-Received: by 2002:a9d:6508:: with SMTP id i8mr1032007otl.368.1624472668467; Wed, 23 Jun 2021 11:24:28 -0700 (PDT) Received: from localhost.localdomain.com (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id l24sm105186oii.45.2021.06.23.11.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:24:28 -0700 (PDT) From: trix@redhat.com To: hao.wu@intel.com, mdf@kernel.org, michal.simek@xilinx.com Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tom Rix Subject: [PATCH v3 2/7] fpga-mgr: make write_complete() op optional Date: Wed, 23 Jun 2021 11:24:05 -0700 Message-Id: <20210623182410.3787784-4-trix@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210623182410.3787784-1-trix@redhat.com> References: <20210623182410.3787784-1-trix@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=trix@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210623_112434_149987_5229A8B6 X-CRM114-Status: GOOD ( 14.63 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Tom Rix An FPGA manager should not be required to provide a write_complete function if there is nothing. Move the op check to the existing wrapper. Default to success. Remove noop function. Signed-off-by: Tom Rix --- drivers/fpga/fpga-mgr.c | 7 ++++--- drivers/fpga/zynqmp-fpga.c | 7 ------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index 87bbb940c9504..1c2cce1320367 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c @@ -152,10 +152,11 @@ static int fpga_mgr_write_init_sg(struct fpga_manager *mgr, static int fpga_mgr_write_complete(struct fpga_manager *mgr, struct fpga_image_info *info) { - int ret; + int ret = 0; mgr->state = FPGA_MGR_STATE_WRITE_COMPLETE; - ret = mgr->mops->write_complete(mgr, info); + if (mgr->mops && mgr->mops->write_complete) + ret = mgr->mops->write_complete(mgr, info); if (ret) { dev_err(&mgr->dev, "Error after writing image data to FPGA\n"); mgr->state = FPGA_MGR_STATE_WRITE_COMPLETE_ERR; @@ -576,7 +577,7 @@ struct fpga_manager *fpga_mgr_create(struct device *parent, const char *name, struct fpga_manager *mgr; int id, ret; - if (!mops || !mops->write_complete || !mops->state || + if (!mops || !mops->state || (!mops->write && !mops->write_sg) || (mops->write && mops->write_sg)) { dev_err(parent, "Attempt to register without fpga_manager_ops\n"); diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c index 125743c9797ff..9efbd70aa6864 100644 --- a/drivers/fpga/zynqmp-fpga.c +++ b/drivers/fpga/zynqmp-fpga.c @@ -66,12 +66,6 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr, return ret; } -static int zynqmp_fpga_ops_write_complete(struct fpga_manager *mgr, - struct fpga_image_info *info) -{ - return 0; -} - static enum fpga_mgr_states zynqmp_fpga_ops_state(struct fpga_manager *mgr) { u32 status = 0; @@ -87,7 +81,6 @@ static const struct fpga_manager_ops zynqmp_fpga_ops = { .state = zynqmp_fpga_ops_state, .write_init = zynqmp_fpga_ops_write_init, .write = zynqmp_fpga_ops_write, - .write_complete = zynqmp_fpga_ops_write_complete, }; static int zynqmp_fpga_probe(struct platform_device *pdev)