From patchwork Wed Jun 23 18:24:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 12340333 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=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 2C18FC4743C for ; Wed, 23 Jun 2021 18:27:35 +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 F0EA161166 for ; Wed, 23 Jun 2021 18:27:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0EA161166 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=OmQKAeQN0stTkQPTlxCBzknOAe9cakRzsD75glGqPks=; b=mGYS70YvupL70q 1JJWoGSmEqezN/MUxJJxTw6dpEQgGy2c7/WsHUVjVYw9i015G1TU2lIUWomX/2xSbtKSsHoMNW5Rm FsiFe/oCqAoPuXq/0A35wf2bnh2QIgprtYaQR2An/ksnaNuCBGPd/Hgc2Vk/wGijuYluGMA+7Y4PD T+s+AKXF2fX1mvGLV8JlQbfFBOhUIi8+aeevK2JLl0MktxrXd/Gbck5NGNjeT/CTznFs9D9zWfC2U /kOQqf2xtV3RvU/uZR8Pkl5lUh2C1ICYZwsZGQ1uiU+5QN4nxP0IK+mWOS+uOOiQR/bGg0Leq4s78 GyiFLeFEyp0SvRP26ahQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lw7Yx-00BcPh-9Z; Wed, 23 Jun 2021 18:25:23 +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 1lw7YD-00BcBi-NY for linux-arm-kernel@lists.infradead.org; Wed, 23 Jun 2021 18:24:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624472676; 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=zt+reJW9iH4L44dg7M6KqKyx61iwDVr84RgiCAGE6Po=; b=ajEOy87Y4ZcUD/03EEokPo51QuKwrwnkMxQUUMw9OzxzWj6FAZVIfuhSECNHk4n4Eh8zgl QorAYBT/xX8IOAwfOhMjdxWA8rPBaXXJ1RzEI8651vPnGz0HCAjj0CRRkCUK+RpBf3yeIM mfRQz3hJiNKe6tKuJpVR1iOTeLUGXqM= 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-34-Fct-K1D7PEKzgqxMOprYRw-1; Wed, 23 Jun 2021 14:24:34 -0400 X-MC-Unique: Fct-K1D7PEKzgqxMOprYRw-1 Received: by mail-ot1-f72.google.com with SMTP id e28-20020a9d491c0000b02903daf90867beso1799093otf.11 for ; Wed, 23 Jun 2021 11:24:34 -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=zt+reJW9iH4L44dg7M6KqKyx61iwDVr84RgiCAGE6Po=; b=d6pZwCJkmOovaT/nHmZ7y7rovb/Z0E6hsM/nyTQI8kWjNkED7rcS11vGasUGP8bzdd WuAeNPUhguJRxVynCid8drHa/DwfOfQGQJB/YuqxDVuLOjRJH/30bDzwwBHOgDiO6Jtn XzawlOK5h+V22rUkrFApqL85tFM4Cy03++dRaVry3G+y1AlJudAQK+GnRxBR7hMO8s1w ehJGxGbZvv+UCOcz3fSYuA1zuvDFImrJaGD6fygYkv+K8If8M1skPPnjPvF/E08MDiQH QH3NCuk/r/H3KfuO4KusvsRQ+zzlsnHvcF86Yg5zYKzftH4J4AflVD5Gmd/IjymkUqW3 rMLw== X-Gm-Message-State: AOAM530ot8IgLVYmw4W4KQ8gk/6NxYqrJYEryD/Ew/hPUNMC/hh58QGJ cBf2h9lbNIRHMoZ83cU6ehft31jSs66Kxxcc5T4G1imM7MyJD3ZpdwXHrGYbeo78O/SQe9EDbXf vmIr3kOD/7c8PU1O2wm+HfF/3AkY4H8jSPDU= X-Received: by 2002:a4a:db42:: with SMTP id 2mr924976oot.47.1624472673542; Wed, 23 Jun 2021 11:24:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz4UFSl246oaEQqLiNgeEp6ZLXg4v/5NOgNJIyJ0IuAfGDYUCGLmn5W16/1naj3Oifo/u2IQ== X-Received: by 2002:a4a:db42:: with SMTP id 2mr924957oot.47.1624472673390; Wed, 23 Jun 2021 11:24:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:24:33 -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 4/7] fpga-mgr: wrap the status() op Date: Wed, 23 Jun 2021 11:24:07 -0700 Message-Id: <20210623182410.3787784-6-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_112437_889186_97C49CE8 X-CRM114-Status: GOOD ( 12.27 ) 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 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index 8f97e16e36f7e..6bfc4482abbf4 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c @@ -426,6 +426,14 @@ static ssize_t state_show(struct device *dev, return sprintf(buf, "%s\n", state_str[mgr->state]); } +static u64 fpga_mgr_status(struct fpga_manager *mgr) +{ + if (mgr->mops && mgr->mops->status) + return mgr->mops->status(mgr); + + return 0; +} + static ssize_t status_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -433,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");