From patchwork Mon Jun 7 17:23:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 12304199 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=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 28508C47082 for ; Mon, 7 Jun 2021 17:27:29 +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 E59C36108C for ; Mon, 7 Jun 2021 17:27:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E59C36108C 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=im50gtx20W91eRohskaSUSuZxiQkKgsa+t0I2oYMYCY=; b=Q4VGAdQMZHlzt8 Jd7AJIhdrLBeRG9wz4ZcKb4A9iI/L6j8z+qfCrzRL3QVdPXFwRzVVplY2H5+K5e7v+clcwM59BoYD eFgMPv6o2Y8i8SL0h8ai2zF1iMSDulWMZAn5gU5Sq7+ykd49FgheYXtZWnD3T0+3zxvLsPkNgPpGc WdlbUQRvGGy8kNotEb8BQPLk8GXMrtVNFAnD3IG0hFxpRhPTuSi+ky+wYraByUNVui8e//gX99pIC bS0u2i3OkUIJIButEpMGJ1yxz/n9o8NMd9Y0fvnl0CzOL98eVYLPi46KKqFXYh1FjcNuRUtz8+jrM XwVoWzT5xb5O2PIIQs6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqJ0I-004mQH-26; Mon, 07 Jun 2021 17:25:34 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqIzL-004mAu-T2 for linux-arm-kernel@lists.infradead.org; Mon, 07 Jun 2021 17:24:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623086675; 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=sw7849LMLQbMNBNh72cG9DpmFetu7hYYk7CqmCZ+A8c=; b=IXYTaGR2y5o2laISOmCoQ179C/Mk4m0U+UN4UuC9D7hR9RDHv/mo+1p4ryP8vcacxeH67L Zt3hWsZfMXd5+Eqzi7jvq60IU70BePlKq3Iib18BIexDUogUyCuy0gjHYt6kU49Q+FbhJw 0QngK9b8MDQXlfX2h23O2ynVn4yLH6Y= 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-160-diY4YoyPOdGMvTm3PTuTYA-1; Mon, 07 Jun 2021 13:24:33 -0400 X-MC-Unique: diY4YoyPOdGMvTm3PTuTYA-1 Received: by mail-ot1-f72.google.com with SMTP id k7-20020a9d4b870000b02902a5bfbbbd3bso11977292otf.18 for ; Mon, 07 Jun 2021 10:24:33 -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=sw7849LMLQbMNBNh72cG9DpmFetu7hYYk7CqmCZ+A8c=; b=tg5M204Tn42auroT2klPbSWDPswxFCfhoMU3n9jdQhvtuU0Wv35pu/pMU0AapgOGce rrYKge4QTxOC/2/HXODYkePC+VowYlzU+LexB3SX7k5hA0LDXM4cLTYTZDrPOLL/HLdN dPM9jQxuAYTdYmdxLfRIt2wwViK1zNDeBk42gT18IGk2y10P+heZRSA6BJLC3l3RW5he wdsI8A5T9gjv1aeuPsxhrA4W1Zrrzf6L1Ysp57NxiAgZLn95eljmPSrnv5Jpzu0DA9RW HYHdaEhBnVUuF5OEpc0/TM9h+PFY6/bB6wF+1j9+rRLY6HPXHNAQyJ576MrBEC/u3iKq 62QA== X-Gm-Message-State: AOAM533tg9DftwYIlkOlf3Uf+Bo/Viw72/OLWm1/JcprQu+/wCFnwrol kPJi7XVAUqoKzuLVhOIWFTezX+lwvaxtnZxM4TQ615Yoh10qNFFswoT4RFdmvlpPMJ/sKnHT/gF t4ukozZ20VZQr/cibEKAwAyUrB9I2X81PRLo= X-Received: by 2002:a9d:249:: with SMTP id 67mr14552436otb.356.1623086673292; Mon, 07 Jun 2021 10:24:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaxynMSyVdOH834Xr+aDUn5sjwj9lSK2uSYH4p7kRGsbU3UK3AsLkYepvXRVkAP7p0oedWLA== X-Received: by 2002:a9d:249:: with SMTP id 67mr14552418otb.356.1623086673160; Mon, 07 Jun 2021 10: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 15sm2409859oij.26.2021.06.07.10.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:24:32 -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 4/7] fpga: wrap the status() op Date: Mon, 7 Jun 2021 10:23:59 -0700 Message-Id: <20210607172402.2938697-5-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_102436_055677_D779CFCF X-CRM114-Status: GOOD ( 12.65 ) 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 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 c484b4309b2f..cc531f0537ac 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");