From patchwork Fri Jun 25 19:51:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 12345833 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 442BFC2B9F4 for ; Fri, 25 Jun 2021 19:54:48 +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 0B90961949 for ; Fri, 25 Jun 2021 19:54:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B90961949 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=9Il1VMlWzU9Q/gIe/Z4PlCkSHMYL1hu4Jvhp0a2Q7uI=; b=D73usDrR4QMK+f ZI+FmC1s1cvT4HC6IlW1RisXl2gPSOMXQh7PfsEf4+0hzy+mg1K7+RU9cSjWp/ikePMEsZDCzVK5L BiqOFo3O6DaIcogQ+zoKl6URttqD/DjDaSxUXm6U08+N8wg3dSYkE0JE8xfOxEnpT3m9UBxLRUYw0 uyh4VqbheECcyFscpRIcekq++jsplB3wNUN4pzBEY22asQvyCkDyw06FPXeZnuSESPqI9UdIcRlbT +qZgJvB1rlTHfZhe8i2QLiSjoeZRpC3Jqc+bBX+ZxjsuhR475xIwyWfCweEl8ElUWAOKgZZmliNs+ GW97cSPZuA3YDc4qNQEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwrsf-002ieH-MU; Fri, 25 Jun 2021 19:52:50 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwrsA-002iX0-27 for linux-arm-kernel@lists.infradead.org; Fri, 25 Jun 2021 19:52:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624650737; 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=nd5/Ncm9trzPQHKxxw2QIB0gwtpNADHT5q5Ylf5cTos=; b=czUdyFGinJaITyQqh8w2L/I8mjqGfFmMTT5p9GVrAuVWNAVWJ7bAr/BNzv55ngFrUi3Kt7 ysNP6N4e5+96tiOxtJMysLH9z4oKfAAY+h4xBoODUF9+CvvgPeYtehHZE28Q9rvNkC2cNb qhrbl9APjV+xT1LiWPXqrZMo70ADWy4= Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-0h1K0j6EOcauFLAhVkxjCA-1; Fri, 25 Jun 2021 15:52:13 -0400 X-MC-Unique: 0h1K0j6EOcauFLAhVkxjCA-1 Received: by mail-ot1-f69.google.com with SMTP id v29-20020a056830091db029045efea1ec9bso6551432ott.21 for ; Fri, 25 Jun 2021 12:52:13 -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=nd5/Ncm9trzPQHKxxw2QIB0gwtpNADHT5q5Ylf5cTos=; b=G5w+U0hkW85m8woBBycYTwyzZcT3SeYdtmucG4p9My2dG7Wq5HWskxmvcCn0jjY9ZH nF5lTanKRxIID67yktnyaiH0jm3GkaqlmtufTqFmYiK/AvB6vZu8AVLIxjV1rNfuHwlU 3EWdfGfnfSzpXDzmkNEQQ7V+/36d1kM47CmEHg+ZKz0mWzSXFykXgyZxlibDo0Dh++D7 gQjlGfniQJnXhQ5ATP80HGnh3q2l7BgbXM/HCD62z/wMHTMuAXFRzmYcq7NE7yYYzVYf vL05YqvYJok7NHOvSP9levUg+RCYGc0c/d8Vli3oB8rfd72gYyRagtF8ffCI5FUNJcF0 ZKWA== X-Gm-Message-State: AOAM531xZ6oZY3GlrL6A4mFHET0R/0lANV1N8vVBufrmwnDdcB5KHC4b 8YGgorez6a792fQPKKOGGkbmhuzhO/+AtLU/2pmQ1s3dE/h0JjOALDb6sfnyITrUrnvyfaU6zej AjRdit1a7+pffMeDy0NHICysE7lHixrYKYX4= X-Received: by 2002:a9d:6219:: with SMTP id g25mr11096326otj.262.1624650732933; Fri, 25 Jun 2021 12:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOFoWkEHJLZJiCZogum6sza4B5EXPuEPCfHnSXmakawUVjrxJB8y25xvgEdsfFXS38d1e+fQ== X-Received: by 2002:a9d:6219:: with SMTP id g25mr11096313otj.262.1624650732804; Fri, 25 Jun 2021 12:52:12 -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 o25sm1535446ood.20.2021.06.25.12.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 12:52:12 -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 v4 4/7] fpga-mgr: wrap the status() op Date: Fri, 25 Jun 2021 12:51:45 -0700 Message-Id: <20210625195148.837230-6-trix@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210625195148.837230-1-trix@redhat.com> References: <20210625195148.837230-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-20210625_125218_246662_7826E9AA X-CRM114-Status: GOOD ( 12.56 ) 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 is not required to provide a status() op. Add a wrapper consistent with the other op wrappers. Move the op check to the wrapper. Default to 0, no errors to report. Signed-off-by: Tom Rix --- drivers/fpga/fpga-mgr.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index 8d5536d748081..43518b6eed21e 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c @@ -25,6 +25,13 @@ struct fpga_mgr_devres { struct fpga_manager *mgr; }; +static inline u64 fpga_mgr_status(struct fpga_manager *mgr) +{ + if (mgr->mops->status) + return mgr->mops->status(mgr); + return 0; +} + static inline int fpga_mgr_write(struct fpga_manager *mgr, const char *buf, size_t count) { if (mgr->mops->write) @@ -434,10 +441,7 @@ static ssize_t status_show(struct device *dev, u64 status; int len = 0; - if (!mgr->mops->status) - return -ENOENT; - - status = mgr->mops->status(mgr); + status = fpga_mgr_status(mgr); if (status & FPGA_MGR_STATUS_OPERATION_ERR) len += sprintf(buf + len, "reconfig operation error\n");