From patchwork Wed Jun 23 18:24:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 12340335 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 305DCC4743C for ; Wed, 23 Jun 2021 18:27:43 +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 F0FE461164 for ; Wed, 23 Jun 2021 18:27:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0FE461164 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=LUJsmcRQ+kDIOO1wqnmz3XYH0kVkQ82Q3fxs4egme08=; b=DV8eBZxlvJGEfV aRNygtWz8pSZ6AEysA//CLkV7SWG8cvMGHSi5Sh5OZ/tx3rgo9BDuxK24Mzw46t8oBsTglw4wy41N GDHoCy9A6Ik6aECP15UgWsAutCmRLZBZekES4PS9iL0DZRBiudbu7vVEQeCyf8NC0qQqg6+7X/Eoe VXEWEOf0uquBjEoyNaUE9ZyhmtE2s52MiyTHyet8CaoMB4z6mQ++W9qwvN0/OeBpuTk8LomvKCqJi /TFz8mIiprlAo7jmv2mFU7Hy56KhI3XbNcaOM0zL7U6gazSoHgIafwEpe2ix7K6MMs428nKuqkjeG +STpagzqnpZQcfM+NYhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lw7ZF-00BcV0-4t; Wed, 23 Jun 2021 18:25:41 +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 1lw7YK-00BcDY-Hn for linux-arm-kernel@lists.infradead.org; Wed, 23 Jun 2021 18:24:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624472683; 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=rfUUvCPY/yCW3nF5S1XXaaySwkjQfz2Hdett2DoZIxY=; b=JSuIApkuBe6rcbe8IaOJwfA3RAxpj2Kob3bLx1tYwCKN5IWvs2tQsyGHy04x1o30r+mx1O vRVWAbFXQufyL8JckrH0cll+nPqtOVWRtFHUbWQuY9c64iDAsFov28SI5Ub7L0wnb29rfH VM6oxwyxH7zCBphcShaHNBC0u4fGDvM= Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-178-vBz512P0MSuc1vToScnoQw-1; Wed, 23 Jun 2021 14:24:40 -0400 X-MC-Unique: vBz512P0MSuc1vToScnoQw-1 Received: by mail-oo1-f69.google.com with SMTP id 3-20020a4a03030000b029024950bdb69dso2240027ooi.3 for ; Wed, 23 Jun 2021 11:24:39 -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=rfUUvCPY/yCW3nF5S1XXaaySwkjQfz2Hdett2DoZIxY=; b=IqnIVe2VYQ2zwZQO9HQwa5yU018F056SE+Miazel2AcWTNMNG5TY0otLSAa6VSBXy/ XWr3YlfznR1qAtl1c6XNnhOudDntSJ58m0j2e34ycD97ZuIU4QM8mczBNl5L79nt3Djn ohNjabDphT8/e4kAqzbnba8I0oTy7sSocoxQdnho8bSQacYDCJbmtFyiSI4UgNFLXi6N XNQhmhDDrs4TPH2EkKM1JlHSSBguNfijrhJeVb6qdPSwX2qh57IwrZ5yhLfFhBVKd8cP pvW+NSf0Fc04CLaPeT18MooZcDhr2NU2TWsxLsBQb8266e3l9qQAV//ZEnK0I8pK7bCv /OgA== X-Gm-Message-State: AOAM531geq5vhBeUVgumIRMQUICL8i8NFFJ5TRC2iLKyz7Of0/QA+g5k fNOtOlgLsJICU+8I0iBfDbQIFMJN9wRiEJPPNqmlPCyqfF7mzB3F9cn41Q4zII2LyIvIMqGoQhx E5STl2UUU2dmNGK+LQL53ZCWzQlCiWWZdljc= X-Received: by 2002:a05:6830:33ea:: with SMTP id i10mr1095413otu.342.1624472678446; Wed, 23 Jun 2021 11:24:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR7yevscaTjSXDf/VKL6RCgn8jGzo+VVZs7d7rmrj54N3eCdj0y/Xdcw5y6jjNgsqzE+WPlw== X-Received: by 2002:a05:6830:33ea:: with SMTP id i10mr1095404otu.342.1624472678312; Wed, 23 Jun 2021 11:24:38 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:24:37 -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 6/7] fpga-mgr: wrap the fpga_remove() op Date: Wed, 23 Jun 2021 11:24:09 -0700 Message-Id: <20210623182410.3787784-8-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_112444_722742_7BD8DD8F X-CRM114-Status: GOOD ( 11.43 ) 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 fpga_remove() op. Add a wrapper consistent with the other op wrappers. Move op check to wrapper. Signed-off-by: Tom Rix --- drivers/fpga/fpga-mgr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index 7d50ce26bf00c..1a2b8d8be7674 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c @@ -731,6 +731,12 @@ int fpga_mgr_register(struct fpga_manager *mgr) } EXPORT_SYMBOL_GPL(fpga_mgr_register); +static void fpga_mgr_fpga_remove(struct fpga_manager *mgr) +{ + if (mgr->mops && mgr->mops->fpga_remove) + mgr->mops->fpga_remove(mgr); +} + /** * fpga_mgr_unregister - unregister an FPGA manager * @mgr: fpga manager struct @@ -745,8 +751,7 @@ void fpga_mgr_unregister(struct fpga_manager *mgr) * If the low level driver provides a method for putting fpga into * a desired state upon unregister, do it. */ - if (mgr->mops->fpga_remove) - mgr->mops->fpga_remove(mgr); + fpga_mgr_fpga_remove(mgr); device_unregister(&mgr->dev); }