From patchwork Mon Jun 7 17:23:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 12304165 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.0 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 65E49C47094 for ; Mon, 7 Jun 2021 17:26:59 +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 311D96105A for ; Mon, 7 Jun 2021 17:26:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 311D96105A 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=ZCVZYaSwPC0OWAqYO5FjOkRc9ESZ/sg1JKumW7lhxoU=; b=DohbxWgpjOT7oI v4LXFc0F2kPOtcjPE5GminHWQUAXoEyoXrox3JtryeXtCYDBOBJaw4u6Vmox4hPIwZ/sAIGy1YPnf o5Dl9j5H0u5gWpWfOwEfJHPZorUD2NNaMVb4yHDR01UCwBBceVsa5yd7ROL8z/AlKCHNiV1xKivVx 6hDLNb+46j2Nk/DbuSocAQbWnnjzsn1qEln7g10eCHgXisd+CtyxEiURNETrFy4T4xZ5aN/Era8ih TwyAkSrEsYIz90cFupDcR5XiaAlg6aohS3ru8NBCjYFQfm1Pwx6Y7kuQOQmaV8OWUD+A2SmbFZvFZ mQwbCuITSmMrg7b3S1uA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqIzl-004mH2-1d; Mon, 07 Jun 2021 17:25:01 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqIzJ-004m9I-CQ for linux-arm-kernel@lists.infradead.org; Mon, 07 Jun 2021 17:24:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623086672; 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=5POgGzXgN4h++cWuVkMb7E0DYWkWN/zT+5ctpxHYXH4=; b=SOLWVH20QTRSkTLKbeiTZ1yLXk3ysONQShtQjUS4B5qYpZBZGIVZ9GRcHlmM6zAYMEmaNz Mwi1p6i8sLPwX8xJhFZrK5D+aD81oOjiOEVRY/ef6xl8hkUY+gJ1fhLvcqBBxS+hOIaRFQ ZMCmm4OVUbtEj+BB7o23aC2g6YVj+wQ= Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-293-LnrgRuQ2MaSqUOZXqn3_5w-1; Mon, 07 Jun 2021 13:24:31 -0400 X-MC-Unique: LnrgRuQ2MaSqUOZXqn3_5w-1 Received: by mail-oo1-f72.google.com with SMTP id l13-20020a4aa78d0000b0290245c8f11ac2so11481515oom.11 for ; Mon, 07 Jun 2021 10:24:31 -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=5POgGzXgN4h++cWuVkMb7E0DYWkWN/zT+5ctpxHYXH4=; b=m3JhNlcF8AYLzISDzd+qBz3eH4JfdVsbUnFmVH+UkDZnpdjT3La5nh4NHtIMd1vIbY ziQnPjQs8FOzBIdoJ8dN0gDfberxpHaT4p/nWCr38p4Kvpf0IGYr/m4vSBtt9rYItCo4 JnVFht6GVhKoETX6jhe7JoDDgNpWBDlrJ6DTh6np/LDtfV5hw31ne/8rxkR7cCBqkBt7 1LnZKJuo0xGej/b4K6rygZM30Ssqm6P5cOnlOLyDdjDMPe6coczY6vIAmXMu1vQQ2no7 a2FCJIk58ew7UzfN4X9VH90+m2tgmbk/w8kMInwtWq2bDjoRauTadCxbmNAjIiOTMMco fQBw== X-Gm-Message-State: AOAM532KyBQalvBAOHQvtQa2MpsFp8qu09AyOAqbs7tevG7ibfXrwsuP UrbsuGajN2QwMspeyiRsbRZrU+7FdYtAjL5GPhZpxKpAsjjzQAfnQUpHbNu3rtZ0GrzIOpfCDhy 2xYxh/L/TXFNvZ1QpuUyOIgfFO+XFZtggXMM= X-Received: by 2002:aca:4d3:: with SMTP id 202mr206172oie.9.1623086670702; Mon, 07 Jun 2021 10:24:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyErLrAs2nKUGQD+6vZuLJsm5Ds5EU5sJZCfJ1o9Ju4lJGFyG6X2XnaYzYSzpxZbczqt8XM1A== X-Received: by 2002:aca:4d3:: with SMTP id 202mr206164oie.9.1623086670568; Mon, 07 Jun 2021 10:24:30 -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 15sm2409859oij.26.2021.06.07.10.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:24:30 -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 2/7] fpga: make write_complete() op optional Date: Mon, 7 Jun 2021 10:23:57 -0700 Message-Id: <20210607172402.2938697-3-trix@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210607172402.2938697-1-trix@redhat.com> References: <20210607172402.2938697-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-20210607_102433_520793_7237DC81 X-CRM114-Status: GOOD ( 14.95 ) 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 The board 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 24547e36a56d..dadad2401502 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 *dev, 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(dev, "Attempt to register without fpga_manager_ops\n"); diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c index 125743c9797f..9efbd70aa686 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)