From patchwork Sun Oct 4 05:14:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815521 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E539F112E for ; Sun, 4 Oct 2020 05:15:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CCC3520735 for ; Sun, 4 Oct 2020 05:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788522; bh=/JJzqbv5aBMInZ5ipCV0cOlZFXi7e4RZDZfZFkxCzBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=esJwy2Mv//Sc4Y+kHSCl/bYOzJF6npshFImODne6H9o18+cq+Qabnneak1SMz6gWP JHpEGs6CneIPnUryXsvN6puY3Rkq5XQUWSHKp7XTnLPo5I5RQsnrGtPmEmWN+zUkwf yZ3u0dQqd2i/NXSiZg7/+GnIOD6p8uyBqT3rhK3Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725836AbgJDFOu (ORCPT ); Sun, 4 Oct 2020 01:14:50 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:33761 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725818AbgJDFOt (ORCPT ); Sun, 4 Oct 2020 01:14:49 -0400 Received: by mail-pj1-f66.google.com with SMTP id t23so2387718pji.0; Sat, 03 Oct 2020 22:14:48 -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=e9dROueXo0BgEtMsBpPMHaAR3SvNMce1Uv/F/sJsEdw=; b=SzXc1t8WmEaT4gPTa9Wu7Hh/XKANg2k7I9I7uzi3+rKbjbcPWov8ZrfJBwHqfvNZQ8 gd6E8aWN8ZP8tc5vAVvdzgUbuPPxc+5hmTdxdbxNHjSckBokDZL+UVxX5/FxSZqhD4KA qg/J739XLeWCeWKrXMFgNYoXDzU3lZ4yeeEmEQNb7x9S7DnSOGnBOC/qzyjbmyD4jD9D rwdJ8flg7IQrGCBCQUe4SV5CmxKOg8S619JSqEwQgWhIuwSU0aVHRkEFOURKrlfQ0MO5 uGo52rgYGuSUF+rGVdKOAostUfquVjywsEp+sJSgpBV4F3Rz2kjdd5Off/DwZFdrbFnQ BfFw== X-Gm-Message-State: AOAM531nK8tHRxuJoif6N2mO6faCRNYZ2LaLN7Mc37I98BREZsFkj8zM VxAYf/uKuQts/DDh+vHVLcTsMEQEVP4= X-Google-Smtp-Source: ABdhPJy8ZnJ4aY7II/coq6RV7KcdKTGw1X3kkzNwC1i68pFQCjiBz5fSZmzADaGy6b5tAgE/tMQzlQ== X-Received: by 2002:a17:90a:c28e:: with SMTP id f14mr10285907pjt.83.1601788488269; Sat, 03 Oct 2020 22:14:48 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id d128sm7540251pfd.94.2020.10.03.22.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:47 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 01/10] fpga: fpga-mgr: Add devm_fpga_mgr_register() API Date: Sat, 3 Oct 2020 22:14:14 -0700 Message-Id: <20201004051423.75879-2-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Add a devm_fpga_mgr_register() API that can be used to register a FPGA Manager that was created using devm_fpga_mgr_create(). Introduce a struct fpga_mgr_devres that makes the devres allocation a little bit more readable and gets reused for devm_fpga_mgr_create() devm_fpga_mgr_register(). Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- drivers/fpga/fpga-mgr.c | 76 ++++++++++++++++++++++++++++++----- include/linux/fpga/fpga-mgr.h | 2 + 2 files changed, 68 insertions(+), 10 deletions(-) diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index f38bab01432e..774ac98fb69c 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c @@ -21,6 +21,10 @@ static DEFINE_IDA(fpga_mgr_ida); static struct class *fpga_mgr_class; +struct fpga_mgr_devres { + struct fpga_manager *mgr; +}; + /** * fpga_image_info_alloc - Allocate a FPGA image info struct * @dev: owning device @@ -651,21 +655,21 @@ struct fpga_manager *devm_fpga_mgr_create(struct device *dev, const char *name, const struct fpga_manager_ops *mops, void *priv) { - struct fpga_manager **ptr, *mgr; + struct fpga_mgr_devres *dr; - ptr = devres_alloc(devm_fpga_mgr_release, sizeof(*ptr), GFP_KERNEL); - if (!ptr) + dr = devres_alloc(devm_fpga_mgr_release, sizeof(*dr), GFP_KERNEL); + if (!dr) return NULL; - mgr = fpga_mgr_create(dev, name, mops, priv); - if (!mgr) { - devres_free(ptr); - } else { - *ptr = mgr; - devres_add(dev, ptr); + dr->mgr = fpga_mgr_create(dev, name, mops, priv); + if (!dr->mgr) { + devres_free(dr); + return NULL; } - return mgr; + devres_add(dev, dr); + + return dr->mgr; } EXPORT_SYMBOL_GPL(devm_fpga_mgr_create); @@ -722,6 +726,58 @@ void fpga_mgr_unregister(struct fpga_manager *mgr) } EXPORT_SYMBOL_GPL(fpga_mgr_unregister); +static int fpga_mgr_devres_match(struct device *dev, void *priv, + void *match_data) +{ + struct fpga_mgr_devres *dr = priv; + + return match_data == dr->mgr; +} + +static void devm_fpga_mgr_unregister(struct device *dev, void *priv) +{ + struct fpga_mgr_devres *dr = priv; + + fpga_mgr_unregister(dr->mgr); +} + +/** + * devm_fpga_mgr_register - resource managed variant of fpga_mgr_register() + * @dev: managing device for this FPGA manager + * @mgr: fpga manager struct + * + * This is the devres variant of fpga_mgr_register() for which the unregister + * function will be called automatically when the managing device is detached. + */ +int devm_fpga_mgr_register(struct device *dev, struct fpga_manager *mgr) +{ + struct fpga_mgr_devres *dr; + int err; + + /* Make sure that the struct fpga_manager * that is passed in is + * managed itself. + */ + if (WARN_ON(!devres_find(dev, devm_fpga_mgr_release, + fpga_mgr_devres_match, mgr))) + return -EINVAL; + + dr = devres_alloc(devm_fpga_mgr_unregister, sizeof(*dr), GFP_KERNEL); + if (!dr) + return -ENOMEM; + + err = fpga_mgr_register(mgr); + if (err) { + devres_free(dr); + return err; + } + + dr->mgr = mgr; + devres_add(dev, dr); + + return 0; +} +EXPORT_SYMBOL_GPL(devm_fpga_mgr_register); + static void fpga_mgr_dev_release(struct device *dev) { } diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h index e8ca62b2cb5b..2bc3030a69e5 100644 --- a/include/linux/fpga/fpga-mgr.h +++ b/include/linux/fpga/fpga-mgr.h @@ -198,6 +198,8 @@ void fpga_mgr_free(struct fpga_manager *mgr); int fpga_mgr_register(struct fpga_manager *mgr); void fpga_mgr_unregister(struct fpga_manager *mgr); +int devm_fpga_mgr_register(struct device *dev, struct fpga_manager *mgr); + struct fpga_manager *devm_fpga_mgr_create(struct device *dev, const char *name, const struct fpga_manager_ops *mops, void *priv); From patchwork Sun Oct 4 05:14:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B8EB9618 for ; Sun, 4 Oct 2020 05:14:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F4842073A for ; Sun, 4 Oct 2020 05:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788495; bh=AsKTRzAwkmddsVavqONAy1hHnQJpLDioOse3Fz5ZJEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=h+KAdOUL5OBPpgKy4EZjLrbbm8loUGx4trLvpJWhLZ/PsutY5/A2CEOfIk3mvXWcZ +t965SQ1rjKKoLc3jQHURpLJjg1O/aq8/sr5VUEr3Jic5JEewA1atVF5fnL/G/47D7 ByOJ+Ps+Qnzpe68t664Ztqp5433uX4dtbiHiCc54= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725818AbgJDFOv (ORCPT ); Sun, 4 Oct 2020 01:14:51 -0400 Received: from mail-pj1-f65.google.com ([209.85.216.65]:37264 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbgJDFOu (ORCPT ); Sun, 4 Oct 2020 01:14:50 -0400 Received: by mail-pj1-f65.google.com with SMTP id kk9so3344193pjb.2; Sat, 03 Oct 2020 22:14:50 -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=d2zKZStKzcWmg98lvUeSyfN/9/+uQar1D5BGHJR0sMs=; b=gjuzUyLwvSD3mI/tKm8fbjY0d1z3jrg28sseZYMHEOzkCnk13Iy4wY17ctE5MeDlZy KjEKbtG5exD+J9084vzcRzDoe8d0Cez68UWvJCIctmY4Z7zJz6BpCs1k2LVeHrNEMDLS /mJ1hY53qT+5xbeXLJvaOVpFUfLmJiX9HzpYko5tWwKiQko+MLnn9h8/Cw5Mr+1Lpbti b0xpUR4KdBDR+haxKa9dB35XR9DO7vXkCKFXh9zZTts1MNX7epjOAtQ95LcigTte7pIG tt4yghl6/7VSIdIlzad6EY4m4Vi9cUO3xqgMqq760KOKuEsaxTlixCIHFhlkJvOtNqic E/dQ== X-Gm-Message-State: AOAM531Jx30NRKYj3zlGflx41eMuhdLSY4MTsKSfmSwZWEZdudk9iNr4 YLuhpjArBJYrH3FyLzq5zwh9kGGmL8w= X-Google-Smtp-Source: ABdhPJxRYQRBkbg0GgZNWMM1nKDMiId/ovDb91fIRnSMkHNx4u7R6Ja/V7HikZ8TKKvNf6zwxSf1Eg== X-Received: by 2002:a17:90a:e545:: with SMTP id ei5mr10050838pjb.45.1601788489550; Sat, 03 Oct 2020 22:14:49 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id i17sm7445294pfa.29.2020.10.03.22.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:49 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 02/10] fpga: fpga-mgr: altera-ps-spi: Simplify registration Date: Sat, 3 Oct 2020 22:14:15 -0700 Message-Id: <20201004051423.75879-3-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration by using new devm_fpga_mgr_register() API. Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- drivers/fpga/altera-ps-spi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c index 0221dee8dd4c..23bfd4d1ad0f 100644 --- a/drivers/fpga/altera-ps-spi.c +++ b/drivers/fpga/altera-ps-spi.c @@ -307,18 +307,7 @@ static int altera_ps_probe(struct spi_device *spi) if (!mgr) return -ENOMEM; - spi_set_drvdata(spi, mgr); - - return fpga_mgr_register(mgr); -} - -static int altera_ps_remove(struct spi_device *spi) -{ - struct fpga_manager *mgr = spi_get_drvdata(spi); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(&spi->dev, mgr); } static const struct spi_device_id altera_ps_spi_ids[] = { @@ -337,7 +326,6 @@ static struct spi_driver altera_ps_driver = { }, .id_table = altera_ps_spi_ids, .probe = altera_ps_probe, - .remove = altera_ps_remove, }; module_spi_driver(altera_ps_driver) From patchwork Sun Oct 4 05:14:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815511 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 467DB139A for ; Sun, 4 Oct 2020 05:15:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22AE2206DD for ; Sun, 4 Oct 2020 05:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788518; bh=joJaXkCxoHRNHVM+7YTNd2Idii36t2DaBAU3CYfAq08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CrS1TOYQXSif0rvJ8jFMurcg4vq6+etqXdZDo1IyJKbEBk0eMtWtamYtbWqnY2U5+ SUWPu6O2l6hkJjzbo0/7UkcNG7gqI2XL1Jaz3WqVIDLsIRjy4qmcCkNJz2GrTLhKLX VjLRSVAAwj/Qc9jqukY+Nn5UjWVk/0xtbJmB0beo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725875AbgJDFOz (ORCPT ); Sun, 4 Oct 2020 01:14:55 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35392 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgJDFOv (ORCPT ); Sun, 4 Oct 2020 01:14:51 -0400 Received: by mail-pf1-f194.google.com with SMTP id k8so4330774pfk.2; Sat, 03 Oct 2020 22:14:51 -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=jSj7Q4DJpFXdzJS4vXtNFyUBZMMtSs/e2uyvh4UrDmQ=; b=d39SzYM9WPmFOxpI4dDNg04wfqjYOZfPuqAHm7HfRCD86WiBloduBlPCeAs8r4HQKc R8o4NYzQF6tW1VmIP+Bu5cIMRzxc88EcdYXWtOtfO0jSw+CFAEBB7fNMirzpF7FwadZA KuABYR38LmpdxRvtQCBsAcPtsyxpDQ/LwjMMzv0xqxBRd16guskiXCjYQyLzORcBo9bH UhtcqAyG5Jh2WzXPOT5QI6kKkboJNS6ko82T2Q+fS0KM6Gm1TZEvAWT4qeru9zmTOZz3 +ZFPbLl8t1pUjGPy8segLS6Doo2ICzRIh7xNcpnyMBao1x9sWeehWTJkl7xpWde7pBJ3 75Gg== X-Gm-Message-State: AOAM532Et66OBdUjJ8UQ7U2H13SFaIz9oHH6vb/YGTqqJEKNh+vplxAA V7tbZyLXWQ7rgxnAeS+Jze0U4ha1+1g= X-Google-Smtp-Source: ABdhPJybuo0dyW8OLj8mYrHhMS47SCaTGtBZJS+mWm/CWtLz6MfEeeQJWsN379s5pc735Hfm4Af9vA== X-Received: by 2002:a65:4987:: with SMTP id r7mr8670662pgs.228.1601788490855; Sat, 03 Oct 2020 22:14:50 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id u2sm6249750pji.50.2020.10.03.22.14.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:50 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 03/10] fpga: fpga-mgr: dfl-fme-mgr: Simplify registration Date: Sat, 3 Oct 2020 22:14:16 -0700 Message-Id: <20201004051423.75879-4-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Signed-off-by: Moritz Fischer --- drivers/fpga/dfl-fme-mgr.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/fpga/dfl-fme-mgr.c b/drivers/fpga/dfl-fme-mgr.c index b3f7eee3c93f..3fc2be87d059 100644 --- a/drivers/fpga/dfl-fme-mgr.c +++ b/drivers/fpga/dfl-fme-mgr.c @@ -316,16 +316,7 @@ static int fme_mgr_probe(struct platform_device *pdev) mgr->compat_id = compat_id; platform_set_drvdata(pdev, mgr); - return fpga_mgr_register(mgr); -} - -static int fme_mgr_remove(struct platform_device *pdev) -{ - struct fpga_manager *mgr = platform_get_drvdata(pdev); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } static struct platform_driver fme_mgr_driver = { @@ -333,7 +324,6 @@ static struct platform_driver fme_mgr_driver = { .name = DFL_FPGA_FME_MGR, }, .probe = fme_mgr_probe, - .remove = fme_mgr_remove, }; module_platform_driver(fme_mgr_driver); From patchwork Sun Oct 4 05:14:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815519 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C074139A for ; Sun, 4 Oct 2020 05:15:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 040C120735 for ; Sun, 4 Oct 2020 05:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788522; bh=ziyLYkN4AQ62Ji2g2esVHCXw5jZAHwTNqcgH/FvlIMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VvjmeCjrs0uEqXZM+3XI5Jkg+oP8Nd1JjC7MJqQf00mbvLZdD5+bPu+ztKtVWndKC ec0mS6A1SrQtXiDV+1d4CAoIZjOxTylAxdOPvDPdPjFs4Us6WQaJ0QA6dM8BnAjwJQ BagY798Fn+fRtI4RN6jQK3ajcxdpJOpz0d6Taha8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725869AbgJDFOz (ORCPT ); Sun, 4 Oct 2020 01:14:55 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41301 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbgJDFOx (ORCPT ); Sun, 4 Oct 2020 01:14:53 -0400 Received: by mail-pg1-f195.google.com with SMTP id g9so3102755pgh.8; Sat, 03 Oct 2020 22:14:52 -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=E9sNHTAf1q0OCWdfYetz8n+dad/hcYWb7WiyvqFz4z8=; b=ewqIkGEHgsoaibH0dhw6urDmrO4ue463MJjiF2liOidkErE6wFF7VZJFir9Ou+5w+Q GwI/300Svz25Y3CG/9s4V5IhtAJ2lObvBVKd8RiT5s9ggXnNs4XRJQ91PjoCwZlp9xvk lV8X90cTf0xyAsgWmCVry2MLFHhviVzWgEdx02C5D3MJupD+lvTDkEeIG2pKRxd7a61Y 2QVp2fRBycrgcXzeENrwJpsqZCuf5wWwUnRJwImzOcVunU0UIib5StgHk6XWg77kWkWv Xx5/+nr9vOwGXosLxL9uTDlbwRtY9FBuQg9qlOWKksV4gZucTrXR3e1FFDAPrZKtA2i3 UEAg== X-Gm-Message-State: AOAM532bUYrTW4bqq82rIB5/peMDKzLpLYxzYhi4QmW219zfY0ie9mZ9 sLMY+B3Laobo7ronaknkjwsBRJt2gEg= X-Google-Smtp-Source: ABdhPJxdCnzWHV+RefxbAoMh95yMnrJqDl2iYdqjGpXGo5cYkqv+xJUq4Y6Ol3KlPXz1LZG6F2FSKw== X-Received: by 2002:a63:5006:: with SMTP id e6mr8795282pgb.338.1601788492032; Sat, 03 Oct 2020 22:14:52 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id r14sm6588558pgm.7.2020.10.03.22.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:51 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 04/10] fpga: fpga-mgr: ice40-spi: Simplify registration Date: Sat, 3 Oct 2020 22:14:17 -0700 Message-Id: <20201004051423.75879-5-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- drivers/fpga/ice40-spi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/ice40-spi.c b/drivers/fpga/ice40-spi.c index 8d689fea0dab..69dec5af23c3 100644 --- a/drivers/fpga/ice40-spi.c +++ b/drivers/fpga/ice40-spi.c @@ -183,18 +183,7 @@ static int ice40_fpga_probe(struct spi_device *spi) if (!mgr) return -ENOMEM; - spi_set_drvdata(spi, mgr); - - return fpga_mgr_register(mgr); -} - -static int ice40_fpga_remove(struct spi_device *spi) -{ - struct fpga_manager *mgr = spi_get_drvdata(spi); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } static const struct of_device_id ice40_fpga_of_match[] = { @@ -205,7 +194,6 @@ MODULE_DEVICE_TABLE(of, ice40_fpga_of_match); static struct spi_driver ice40_fpga_driver = { .probe = ice40_fpga_probe, - .remove = ice40_fpga_remove, .driver = { .name = "ice40spi", .of_match_table = of_match_ptr(ice40_fpga_of_match), From patchwork Sun Oct 4 05:14:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6DEE139F for ; Sun, 4 Oct 2020 05:14:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3ED32078D for ; Sun, 4 Oct 2020 05:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788495; bh=Pg5ISaskZYd3GdYgOkdU/3zLL+AwRkJJIeJXLpZh5S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IXprszAfK7+u2RZJXbr4/j1P+qKVUCuw9y4fUv1f3ZiR/crRKSqWw2EzVMeykP8NK +UOneuPtWkIIe7ifN5JrAPKQRw6HZYUuA0dm67DzgaFaMXFgrRZXvgVE7+WuL6k1JA Z5R4eLMGyl9SxVBQyWR3j6juNMj61EEBslnSb9fc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725867AbgJDFOz (ORCPT ); Sun, 4 Oct 2020 01:14:55 -0400 Received: from mail-pg1-f170.google.com ([209.85.215.170]:43635 "EHLO mail-pg1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbgJDFOy (ORCPT ); Sun, 4 Oct 2020 01:14:54 -0400 Received: by mail-pg1-f170.google.com with SMTP id t14so3607268pgl.10; Sat, 03 Oct 2020 22:14:53 -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=CY8rx+JPKKfkbPpYC3tH6s+YCb6Yq/lPkTs7PIs9fZ0=; b=lPl4/TRJIRh+3MpSzQz5buA4CFeYgkZm3M6hYwYG2Q7Wo8KJxpq1nTgisjfNFAh023 nCLmw/PAZUViPnIAeuAmWItDjq4C+4ky+0qB5uEWIZmyJO+em/z194ENbLI230BDUuAB G3in4FeCAVOz/zGqQKZX9vpe7ofQRSuNOMnE2bNP6TyqO+HJ8rB+7u01BLXOCnlPHkZc F4Z+m44g0AgQCUyuHtCc+pQm/IWhB9NV4FFpJE3EW+0vYYdkBo+MyxZLUzCMpuJB758V Z8/t4ML88lhJ9noY5rptEo5C1oRZzIDvlrHbtwA0bbgVs6cX1XrdcyjYhnkFItSd7aSp c9yw== X-Gm-Message-State: AOAM531/Kac+e37mk9xIfOd7mEd/qO5hbroscZ6U767m/a1qVFIYStup iCy+jydCYXF6evZ3A6anqxp8h2fMdVE= X-Google-Smtp-Source: ABdhPJylfz6ldue6IS1BSmQ4jToXnd6z5f5GUuPiixCD0HN3WGR88U6ArNPlB8bpkX35XLSgpDCDIA== X-Received: by 2002:a63:5d66:: with SMTP id o38mr8617139pgm.366.1601788493258; Sat, 03 Oct 2020 22:14:53 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id j25sm7459393pfn.212.2020.10.03.22.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:52 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 05/10] fpga: fpga-mgr: machxo2-spi: Simplify registration Date: Sat, 3 Oct 2020 22:14:18 -0700 Message-Id: <20201004051423.75879-6-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- drivers/fpga/machxo2-spi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/machxo2-spi.c b/drivers/fpga/machxo2-spi.c index b316369156fe..114a64d2b7a4 100644 --- a/drivers/fpga/machxo2-spi.c +++ b/drivers/fpga/machxo2-spi.c @@ -371,18 +371,7 @@ static int machxo2_spi_probe(struct spi_device *spi) if (!mgr) return -ENOMEM; - spi_set_drvdata(spi, mgr); - - return fpga_mgr_register(mgr); -} - -static int machxo2_spi_remove(struct spi_device *spi) -{ - struct fpga_manager *mgr = spi_get_drvdata(spi); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } static const struct of_device_id of_match[] = { @@ -403,7 +392,6 @@ static struct spi_driver machxo2_spi_driver = { .of_match_table = of_match_ptr(of_match), }, .probe = machxo2_spi_probe, - .remove = machxo2_spi_remove, .id_table = lattice_ids, }; From patchwork Sun Oct 4 05:14:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815513 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E427139A for ; Sun, 4 Oct 2020 05:15:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1B0C20735 for ; Sun, 4 Oct 2020 05:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788519; bh=KNZF82YpQ1bErA9WZh2Moah8leIuU9WDY2Uu9rFFWQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Os45Jn25R/l8DqdAKzFAYkb8GbKO8fsEwoeKoOJgIVeOk81Z47nZiMEFtbXtQPTpc gRfuHbR3ReYotwPlE53hm7Le/d19lXddkjRHyc6hs4UNRNOcfw1emyHn2CYKXeG8ZC 3sLV0/zzpwE+94BLukwo2QAi11zgmC/BoQoqjOrg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725909AbgJDFPS (ORCPT ); Sun, 4 Oct 2020 01:15:18 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40890 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbgJDFOz (ORCPT ); Sun, 4 Oct 2020 01:14:55 -0400 Received: by mail-pg1-f194.google.com with SMTP id q18so3611789pgk.7; Sat, 03 Oct 2020 22:14:55 -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=YHhb/VGZB3JzU7sTnLssu5Jr3MlGXPj+7Lz+7APODO4=; b=meaQnoxrohptcmHNyUC8uTsOZmmx0jHlD2E7BEQMOc31qJmv/v9g9pJeYxwUzBv2xa lcfboU6Qpw6x9n85MWpzdIF5lE+8McaRJwH/uVSP4IgMeVMM2Z37hbZ26nseX46o4vSE 4Qsd+i0f64+BVZPfblCxRf/RxsoMMbuf3H7TblM8ZTr9twBdB8XAhs4yfcR7HVcMpPab GOefpgEV4o0JHhjrfxX+6VmSLSFsiBs4ipWqyc4nfTISdzkWRrkaYQn1NtKV9QHzKTlk v/ct4jUti+nVtF68/kVkOzC6w619K8cHPEX2V+rRNsajs5jdin0e9iMw+IM5YjysHfQG vqAw== X-Gm-Message-State: AOAM532AuTOUWE9gjAxDcaIZRybfe8HgDZfuv+AhlYjoUTHD+Q0piHWM +iqW6phmIEhavESvoYPD3PLolkCTwuw= X-Google-Smtp-Source: ABdhPJypO3sAzA2yTYLx70pX8unTTAwZWlujyB1hECE+9ksvS4oO4ztuZCuq9g4bz+o+Q+Ekpx0doQ== X-Received: by 2002:a62:2b8d:0:b029:151:d7b8:ad58 with SMTP id r135-20020a622b8d0000b0290151d7b8ad58mr10508110pfr.51.1601788494519; Sat, 03 Oct 2020 22:14:54 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id b16sm6189565pgj.77.2020.10.03.22.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:54 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 06/10] fpga: fpga-mgr: socfpga: Simplify registration Date: Sat, 3 Oct 2020 22:14:19 -0700 Message-Id: <20201004051423.75879-7-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- drivers/fpga/socfpga.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c index 4a8a2fcd4e6c..1f467173fc1f 100644 --- a/drivers/fpga/socfpga.c +++ b/drivers/fpga/socfpga.c @@ -576,18 +576,7 @@ static int socfpga_fpga_probe(struct platform_device *pdev) if (!mgr) return -ENOMEM; - platform_set_drvdata(pdev, mgr); - - return fpga_mgr_register(mgr); -} - -static int socfpga_fpga_remove(struct platform_device *pdev) -{ - struct fpga_manager *mgr = platform_get_drvdata(pdev); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } #ifdef CONFIG_OF @@ -601,7 +590,6 @@ MODULE_DEVICE_TABLE(of, socfpga_fpga_of_match); static struct platform_driver socfpga_fpga_driver = { .probe = socfpga_fpga_probe, - .remove = socfpga_fpga_remove, .driver = { .name = "socfpga_fpga_manager", .of_match_table = of_match_ptr(socfpga_fpga_of_match), From patchwork Sun Oct 4 05:14:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815501 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BEAC112E for ; Sun, 4 Oct 2020 05:15:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 418F9206DD for ; Sun, 4 Oct 2020 05:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788507; bh=w+DCU3v7ZQ+fY0fqyn1JqTk9eyfjaPhmDjap4vVvBZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PYoT5k/TBIPCzpzqHD//H6qnf0In7R38mSI8rSlEDaP8hKiTUHJfM2/sAjUJ7vZx0 aHFz16BLpgCLQsbQAHVHaElhdnFdzQOF6uasfNf+7KjJs3jZZ2H9qcMxWTESurpj7a yfdXKMJIflh0xRdxQuZQY4gpIh5pKM8+zY7ojm5w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725910AbgJDFPD (ORCPT ); Sun, 4 Oct 2020 01:15:03 -0400 Received: from mail-pj1-f65.google.com ([209.85.216.65]:55943 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbgJDFO4 (ORCPT ); Sun, 4 Oct 2020 01:14:56 -0400 Received: by mail-pj1-f65.google.com with SMTP id ds1so350079pjb.5; Sat, 03 Oct 2020 22:14:56 -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=FaAVNF3/AlS92Q3NEttM+dWDO+XxWPGiLzHX02RqSVo=; b=WHB4R0Fzb64rlVnpgJU8xAFtKHn2sdWQUBmRATZrcWm2cy98OKa4dDp8JaB3E0rWuv NBEb7sLZY+ezfwFFwiu/qC/8bui/OhXelD8FBsTbi6SyH52/Suowgz4QF519EJMPjQNc 1p6KrjmkINQbtiXQRoByW5IisPqWCVCoaCQbXuJJj5WrSovaQqQ3YyIMojba+cIftK+T V3vcvdb+0IxIF5kvjD6+WCX6aiw3eATknvl8qmyoDhCVUzxpcTFgdA1UjU/Bm4xxA6K1 FNzw+VoFI69Gn0NkQ7isb5ZzzP+D6NJcajZVP5z7nB3Ir/pAo5G55A/lPgXTu2HtTmKh gXRg== X-Gm-Message-State: AOAM530jvGNHmH6adXqdo/ZpRUBtLPq3CwJ2jUb0+sJDQliJk8QFd3UX Fd9RbTgWNXXywc4ghWQdccaIpKr8glM= X-Google-Smtp-Source: ABdhPJwNlr6JI0F4V2li4qN9l3534sjOYx5SocCCZjzYxaKbo6UgCuL2JAYmNNUb2HAmJgoHrgbflw== X-Received: by 2002:a17:90b:4d0d:: with SMTP id mw13mr10418192pjb.192.1601788495740; Sat, 03 Oct 2020 22:14:55 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id i62sm7782184pfe.140.2020.10.03.22.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:55 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 07/10] fpga: fpga-mgr: ts73xx: Simplify registration Date: Sat, 3 Oct 2020 22:14:20 -0700 Message-Id: <20201004051423.75879-8-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- drivers/fpga/ts73xx-fpga.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/ts73xx-fpga.c b/drivers/fpga/ts73xx-fpga.c index 2888ff000e4d..101f016c6ed8 100644 --- a/drivers/fpga/ts73xx-fpga.c +++ b/drivers/fpga/ts73xx-fpga.c @@ -127,18 +127,7 @@ static int ts73xx_fpga_probe(struct platform_device *pdev) if (!mgr) return -ENOMEM; - platform_set_drvdata(pdev, mgr); - - return fpga_mgr_register(mgr); -} - -static int ts73xx_fpga_remove(struct platform_device *pdev) -{ - struct fpga_manager *mgr = platform_get_drvdata(pdev); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(kdev, mgr); } static struct platform_driver ts73xx_fpga_driver = { @@ -146,7 +135,6 @@ static struct platform_driver ts73xx_fpga_driver = { .name = "ts73xx-fpga-mgr", }, .probe = ts73xx_fpga_probe, - .remove = ts73xx_fpga_remove, }; module_platform_driver(ts73xx_fpga_driver); From patchwork Sun Oct 4 05:14:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815505 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98E25112E for ; Sun, 4 Oct 2020 05:15:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 813582073A for ; Sun, 4 Oct 2020 05:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788517; bh=OLf9nj5gslxc5Y9rFE28gpvcy5T2xrJo9wj+ufRFRNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PHBrgRPQG5jqysZHiIkt8InxxO7Iz+ObUSRCvw8McfzOALO8ZnRJYXV0ubm7SFnYS aWi6hTVCA784nukxB1h+l0j8s4HGn63hNHSDmRTAhUDvldUIpgha8AsZjiUNqpGb5B w3fzWiYXiB2nnKma+yeTufMVCgpNKOHJLFVo7sVI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725931AbgJDFPH (ORCPT ); Sun, 4 Oct 2020 01:15:07 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37470 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbgJDFO7 (ORCPT ); Sun, 4 Oct 2020 01:14:59 -0400 Received: by mail-pg1-f196.google.com with SMTP id h6so2939041pgk.4; Sat, 03 Oct 2020 22:14:57 -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=47sHf0OnbQAgrjSXH2UeNqKvTmvp8QgcUk98MlVaxRo=; b=lq74pZvFQlb+ayPtSk8QvjDtRmHy72G3lNtpV29wTEK8sOuW353HJOHLB6umHdyr6s YwqJ6fLX5AFAkyvoXPtcAt2IiJ8+d9D43j6KPTO+gDxMiECRsBcYjXM/JVt0R2/N1SVe whzneBilB7ZCglKcx6O038R+wO0c3aOIq+hn+ox2cyPPNTjdVnMDnE07BOsPfIZpxduN j/Y6mdZTkaCtVEInYw51LOI91iZo5vmnmMzdrCqysM7m0U2OMVm2b35KZ1pnkmvBeoVi sUIb6hgAVQmUSiM/3yAYdqb+BlUbP0RgGjDyy8WkqeaOf4LfOR1z6/ZBMk31to0ASde9 FyXg== X-Gm-Message-State: AOAM531LR6L8zN3EBi6ClK2Oq6uzaEcwNQDPQBrJaf3zfDnm6ynSf9FV PnCHyx/WFRX2LPdlk7YaORPAPzWyMec= X-Google-Smtp-Source: ABdhPJwvB3KaWGtsz2s+wyqr5IaazCnC6zzrFStHbeGJ/MYzvM7nhhvGhl36qlG0BApYbR1ts1mxsg== X-Received: by 2002:a62:1d06:0:b029:152:1b07:7e3b with SMTP id d6-20020a621d060000b02901521b077e3bmr10594286pfd.30.1601788496952; Sat, 03 Oct 2020 22:14:56 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id 5sm4505745pfg.152.2020.10.03.22.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:56 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 08/10] fpga: fpga-mgr: xilinx-spi: Simplify registration Date: Sat, 3 Oct 2020 22:14:21 -0700 Message-Id: <20201004051423.75879-9-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- drivers/fpga/xilinx-spi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c index 824abbbd631e..27defa98092d 100644 --- a/drivers/fpga/xilinx-spi.c +++ b/drivers/fpga/xilinx-spi.c @@ -259,18 +259,7 @@ static int xilinx_spi_probe(struct spi_device *spi) if (!mgr) return -ENOMEM; - spi_set_drvdata(spi, mgr); - - return fpga_mgr_register(mgr); -} - -static int xilinx_spi_remove(struct spi_device *spi) -{ - struct fpga_manager *mgr = spi_get_drvdata(spi); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(&spi->dev, mgr); } static const struct of_device_id xlnx_spi_of_match[] = { @@ -285,7 +274,6 @@ static struct spi_driver xilinx_slave_spi_driver = { .of_match_table = of_match_ptr(xlnx_spi_of_match), }, .probe = xilinx_spi_probe, - .remove = xilinx_spi_remove, }; module_spi_driver(xilinx_slave_spi_driver) From patchwork Sun Oct 4 05:14:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815503 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B45F112E for ; Sun, 4 Oct 2020 05:15:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 771D92073A for ; Sun, 4 Oct 2020 05:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788508; bh=hl9/Vlz0IhknUFLHFYxD/tIyDrJA6JyrOa4kBFuagFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GcyOjU0eVstqVgBwjWu5h5M63BtWeXqHRGvY8M3TzGqNQI8iGZur63VGv0MvgXJaA /RzLnLXJ8ta0m1O8naTaJN7fjmdPBcL5OeEXMT9cgVm/MtG1dULh6jlAptvZgCc0wp Bl3N68EuhU6OKMnmWjL6EFFgwdtYQlWjvIIa6Qts= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725929AbgJDFPH (ORCPT ); Sun, 4 Oct 2020 01:15:07 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40898 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725908AbgJDFO7 (ORCPT ); Sun, 4 Oct 2020 01:14:59 -0400 Received: by mail-pg1-f195.google.com with SMTP id q18so3611843pgk.7; Sat, 03 Oct 2020 22:14:58 -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=l0sL7ADN3Hq+42GWHoUqJqayEjL3b9dF3MMfLH2Y9NQ=; b=PATbyoXhYorfgAaoW8mhSBodjDeQNLFjr5yoL5BT8gJRMVQE+ANAgrB++A6xjkiQIG 99pUIaEbhpO0vqB+IulDqZHqUJ52ntMb6fQQdXFmoLFO/0zGgsK/4n8Ac4RZZlv1Hh4S Tr00q5B1Jm9oTkVTHGSQFTdlnZ/pj3JA0jmKdI943b4OomoUcPLh+HkK++Q02o9BX0b6 mOXn+/+BmjnMADHkhN4ALqx3oh58duC+5tUBlTgkHH6BFD35xW82jMGdoC5rklWNSgjf SUyYMa6exx5OgjQSKURlzubR+VGSPuRB3CNBAUuuP6qGpzjyhtb5VPdW0O8EQKu+hAsA AV7w== X-Gm-Message-State: AOAM532oJ0Sc7fO6Vn51G722VRFfXUwOwc2ximJ/NnfkjuNnsn9UbiAL 0yrxxFGQBLFbaLuzjNAIH3gSd9qNRaY= X-Google-Smtp-Source: ABdhPJzFayjCJtOlCCDp1euNS+8aBlvXNaFrFBJ5JLikW0r8Gujg+MhK1dPOtDj2wkEnQuwZAH6iVA== X-Received: by 2002:a63:1958:: with SMTP id 24mr8687000pgz.326.1601788498162; Sat, 03 Oct 2020 22:14:58 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id x6sm6145100pjp.25.2020.10.03.22.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:57 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 09/10] fpga: fpga-mgr: zynqmp: Simplify registration Date: Sat, 3 Oct 2020 22:14:22 -0700 Message-Id: <20201004051423.75879-10-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- drivers/fpga/zynqmp-fpga.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c index 4a1139e05280..125743c9797f 100644 --- a/drivers/fpga/zynqmp-fpga.c +++ b/drivers/fpga/zynqmp-fpga.c @@ -95,7 +95,6 @@ static int zynqmp_fpga_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct zynqmp_fpga_priv *priv; struct fpga_manager *mgr; - int ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -108,24 +107,7 @@ static int zynqmp_fpga_probe(struct platform_device *pdev) if (!mgr) return -ENOMEM; - platform_set_drvdata(pdev, mgr); - - ret = fpga_mgr_register(mgr); - if (ret) { - dev_err(dev, "unable to register FPGA manager"); - return ret; - } - - return 0; -} - -static int zynqmp_fpga_remove(struct platform_device *pdev) -{ - struct fpga_manager *mgr = platform_get_drvdata(pdev); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } static const struct of_device_id zynqmp_fpga_of_match[] = { @@ -137,7 +119,6 @@ MODULE_DEVICE_TABLE(of, zynqmp_fpga_of_match); static struct platform_driver zynqmp_fpga_driver = { .probe = zynqmp_fpga_probe, - .remove = zynqmp_fpga_remove, .driver = { .name = "zynqmp_fpga_manager", .of_match_table = of_match_ptr(zynqmp_fpga_of_match), From patchwork Sun Oct 4 05:14:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11815507 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA929139F for ; Sun, 4 Oct 2020 05:15:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A32AD207EA for ; Sun, 4 Oct 2020 05:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601788517; bh=W8Vr94+ee+6VVxayjjDcN3o7Roa5nfrrBRRzKIdvhKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KRjm4ziwb+m+Y2LvD6ukqHSCn0QnCWnmRIkh6cPYTnxcFjxIs1LEATzBtp2R2QPug mqgN/Sgucn3XFT84z0eIWXYWuVqKyYflmKtV4sPYwVaJo/MkHrK1urheUCfpFdQ5wl NeuDC6lfReIaZZkso3PTjeSZOvqE/g3OMzJarZhI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725849AbgJDFPH (ORCPT ); Sun, 4 Oct 2020 01:15:07 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33144 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgJDFPA (ORCPT ); Sun, 4 Oct 2020 01:15:00 -0400 Received: by mail-pg1-f194.google.com with SMTP id o25so3629311pgm.0; Sat, 03 Oct 2020 22:15:00 -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=KEIkOfJmCkr+mhT8bgXa4RUyoZrWLuARarkprMlR8hc=; b=OzyP89KzGNiBMLR3F+3dCT7FyS+OwNtCiVu+9jMaLZg5yUROePP+fc/2nR6SlFwQ5n b6XtfjpFv55EGkWdMN3EA5JPN23zHZIiZ7as5ZUjrPf7UYRcwVMJv0FR6X+CTuarRVbd IbUQuXUFgV1/dNnc/16PSanT0hlcBFwoiviOjaTsOzqw2iS3OxNVYhOyUsOuDRLoGhZQ gUCxZ5Ntv8qcfdfs3h1ilGcnVVn1rvdEZST0npugvcp/sFrejV8BmGy4/Ee6rWtQHD94 ad/OpS9UJQ7IHtat1E6Fga82w4PzBAqqyXsCCLCUA0T+4Kpkeh6AbOyiLc5DXLAe2D8T ZRYw== X-Gm-Message-State: AOAM532gSo/BM8ViewjwC210iDSy5TFrjVKArJ1ToQkUoVDNsSQgn8aw jYbF3m7Y9SOJhNJdeZwmuvdOUdK8KPs= X-Google-Smtp-Source: ABdhPJxBFvc18Vo2CntFUWWe0qTHBP6EsWSvDe3RC70HKzn/p+q5e49ivi4n+Rtv76OD8E2enCUyiQ== X-Received: by 2002:a62:2581:0:b029:13f:ba38:b113 with SMTP id l123-20020a6225810000b029013fba38b113mr10296040pfl.15.1601788499350; Sat, 03 Oct 2020 22:14:59 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id q15sm6177964pjp.26.2020.10.03.22.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 22:14:58 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH 10/10] fpga: fpga-mgr: altera-pr-ip: Simplify registration Date: Sat, 3 Oct 2020 22:14:23 -0700 Message-Id: <20201004051423.75879-11-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004051423.75879-1-mdf@kernel.org> References: <20201004051423.75879-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Remove the now obsolete altera_pr_unregister() function. Signed-off-by: Moritz Fischer --- We should take another look at this, IIRC correctly the point of splitting this up into a separate driver was to make it useable by a different (pci?) driver later on. It doesn't seem like this happened, and I think we should just make this a platform driver? --- drivers/fpga/altera-pr-ip-core-plat.c | 10 ---------- drivers/fpga/altera-pr-ip-core.c | 14 +------------- include/linux/fpga/altera-pr-ip-core.h | 1 - 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/fpga/altera-pr-ip-core-plat.c b/drivers/fpga/altera-pr-ip-core-plat.c index 99b9cc0e70f0..b008a6b8d2d3 100644 --- a/drivers/fpga/altera-pr-ip-core-plat.c +++ b/drivers/fpga/altera-pr-ip-core-plat.c @@ -28,15 +28,6 @@ static int alt_pr_platform_probe(struct platform_device *pdev) return alt_pr_register(dev, reg_base); } -static int alt_pr_platform_remove(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - - alt_pr_unregister(dev); - - return 0; -} - static const struct of_device_id alt_pr_of_match[] = { { .compatible = "altr,a10-pr-ip", }, {}, @@ -46,7 +37,6 @@ MODULE_DEVICE_TABLE(of, alt_pr_of_match); static struct platform_driver alt_pr_platform_driver = { .probe = alt_pr_platform_probe, - .remove = alt_pr_platform_remove, .driver = { .name = "alt_a10_pr_ip", .of_match_table = alt_pr_of_match, diff --git a/drivers/fpga/altera-pr-ip-core.c b/drivers/fpga/altera-pr-ip-core.c index 2cf25fd5e897..dfdf21ed34c4 100644 --- a/drivers/fpga/altera-pr-ip-core.c +++ b/drivers/fpga/altera-pr-ip-core.c @@ -195,22 +195,10 @@ int alt_pr_register(struct device *dev, void __iomem *reg_base) if (!mgr) return -ENOMEM; - dev_set_drvdata(dev, mgr); - - return fpga_mgr_register(mgr); + return devm_fpga_mgr_register(dev, mgr); } EXPORT_SYMBOL_GPL(alt_pr_register); -void alt_pr_unregister(struct device *dev) -{ - struct fpga_manager *mgr = dev_get_drvdata(dev); - - dev_dbg(dev, "%s\n", __func__); - - fpga_mgr_unregister(mgr); -} -EXPORT_SYMBOL_GPL(alt_pr_unregister); - MODULE_AUTHOR("Matthew Gerlach "); MODULE_DESCRIPTION("Altera Partial Reconfiguration IP Core"); MODULE_LICENSE("GPL v2"); diff --git a/include/linux/fpga/altera-pr-ip-core.h b/include/linux/fpga/altera-pr-ip-core.h index 0b08ac20ab16..a6b4c07858cc 100644 --- a/include/linux/fpga/altera-pr-ip-core.h +++ b/include/linux/fpga/altera-pr-ip-core.h @@ -13,6 +13,5 @@ #include int alt_pr_register(struct device *dev, void __iomem *reg_base); -void alt_pr_unregister(struct device *dev); #endif /* _ALT_PR_IP_CORE_H */